fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll long long
  5. #define ull unsigned long long
  6. #define ld long double
  7.  
  8. void Free_palestine() {
  9. ios::sync_with_stdio(false);
  10. cin.tie(NULL);
  11. cout.tie(NULL);
  12. }
  13.  
  14. const int N = 2e5 + 5;
  15. const int MOD = 1e9 + 7;
  16. const int MAXN = 1e5 + 5;
  17.  
  18.  
  19. signed main(){
  20. Free_palestine();
  21. string st;
  22. cin >> st;
  23.  
  24. bool flag = 1;
  25. for (int i = 1; i < st.size(); i++) {
  26. if (islower(st[i])) {
  27. flag = 0;
  28. break;
  29. }
  30. }
  31.  
  32.  
  33. if (flag) {
  34. for (int i = 0; i < st.size(); i++) {
  35. if (isupper(st[i])) {
  36. st[i] = tolower(st[i]);
  37. } else {
  38. st[i] = toupper(st[i]);
  39. }
  40. }
  41. }
  42.  
  43. cout << st << "\n";
  44. return 0;
  45. }
Success #stdin #stdout 0s 5324KB
stdin
Lock
stdout
Lock