Guest User

Vigyazz mert harap

a guest
Nov 17th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6.     std::string x;
  7.     std::cin >> x;
  8.     short unsigned count = 0;
  9.     short unsigned countAll = 0;
  10.     for (char i : x)
  11.     {
  12.         if (!(i & 0x20))
  13.             count++;
  14.         countAll++;
  15.     }
  16.     countAll -= count;
  17.     if (countAll == 0 || (countAll == 1 && x[0] & 0x20))
  18.     {
  19.         for (short unsigned i = 1; i < countAll + count; ++i)
  20.         {
  21.             x[i] ^= 32;
  22.         }
  23.         x[0] &= ~32;
  24.     }
  25.     std::cout << x;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment