这题其实比A题更简单,用了这个函数更方便:
isupper(c)
:判断c是否是大写
islower(c)
:判断c是否是小写
#include<bits/stdc++.h>
using namespace std;
string s;
int big,small;
map<char,bool>m;
int main(){
cin>>s;
for(int i=0;s[i];i++){
big+=bool(isupper(s[i]));//判断大写
small+=bool(islower(s[i]));//判断小写
if(m[s[i]]==1){//如果之前出现过,直接输出No
printf("No");
return 0;
}
m[s[i]]=1;//别忘了标记
}
if(big!=0 && small!=0) printf("Yes");//必须大小写都有
else printf("No");
return 0;
}