fork download
  1. // https://c...content-available-to-author-only...s.com/group/ctwVty4ZXZ/contest/273704/problem/D
  2.  
  3. #include <bits/stdc++.h>
  4.  
  5. using namespace std;
  6.  
  7. typedef long long int ll;
  8. typedef long double ld;
  9.  
  10. char c;
  11. string s;
  12. bool flag = false, fflag = false;
  13.  
  14. int main()
  15. {
  16. cin >> s;
  17. // Check all letters are upper except the first one.
  18. for (int i = 1; s[i]; i++)
  19. {
  20. c = s[i];
  21. if (!isupper(c))
  22. {
  23. flag = true;
  24. break;
  25. }
  26. }
  27.  
  28. if (!flag)
  29. {
  30. transform(s.begin(), s.end(), s.begin(), ::tolower);
  31. s[0] = toupper(s[0]);
  32. cout << s << endl;
  33. }
  34. else
  35. {
  36. cout << s << endl;
  37. }
  38.  
  39. return 0;
  40. }
Success #stdin #stdout 0s 4212KB
stdin
Standard input is empty
stdout