Advertisement
suyashsngh250

Untitled

Jul 28th, 2021
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include<string>
  3. #include <iterator>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.  
  9. string str;
  10. cin>>str;
  11. int count(0);
  12. int len = str.length();
  13. bool flag = true;
  14. char first{str[0]};
  15.  
  16. if(isupper(first))
  17. {
  18. for(int i = 1; i<len; i++)
  19. {
  20. if(islower(str[i]))
  21. {
  22. count++;
  23. }
  24. }
  25. }
  26.  
  27. count = count;
  28.  
  29.  
  30. if (count == len - 1){flag = false;}
  31. count = 0;
  32.  
  33. if(len = 1 && islower(first)){flag = true;}
  34.  
  35. while(flag)
  36. {
  37. for(auto& i : str)
  38. {
  39. if(isupper(i))
  40. {
  41. i = tolower(i);
  42. }
  43. else if (islower(i))
  44. {
  45. i = toupper(i);
  46. }
  47. }
  48. break;
  49. }
  50.  
  51. cout<<str<<endl;
  52.  
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement