大厂笔试题
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
698 B

  1. /*小美定义以下三种单词是合法的:1.所有字母都是小写。例如: good。2.所有字母都是大写。例如:APP。
  2. 3.:Alice
  3. 使?
  4. */
  5. #include <iostream>
  6. #include <string>
  7. using namespace std;
  8. int main() {
  9. string s;
  10. getline(cin, s);
  11. int l = 0, h = 0;
  12. for(int i = 0; i < s.size(); i++){
  13. if(s[i] - 'a' >= 0)l++;
  14. else h++;
  15. }
  16. int opt = min(l,h);
  17. if((s[0] - 'a')<0)opt = min(opt,h - 1);
  18. cout<<opt;
  19. return 0;
  20. }