class Solution {
public:
bool detectCapitalUse(string word) {
auto n=word.size();
if(n==0) return false;
int flag1=-1, flag2=-1;
for(int i=1; i<n; i++)
{
if(word[i]>=65 && word[i]<=91)
flag1=0;
if(word[i]>=97 && word[i]<=122)
flag2=0;
}
if(flag1==0 && flag2==0 || word[0]>=97 && word[0]<=122 && flag1==0)
return false;
else return true;
}
};