bool detectCapitalUse(char * word){ bool smallFlag=false; int cnt=0; for(int i=0; i<strlen(word); i++){ if(word[i]>='A' && word[i]<='Z'){ cnt++; if(smallFlag) return false; } if(word[i]>='a' && word[i]<='z'){ if(cnt>1) return false; smallFlag=true; } } return true; }