Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- int main()
- {
- std::string x;
- std::cin >> x;
- short unsigned count = 0;
- short unsigned countAll = 0;
- for (char i : x)
- {
- if (!(i & 0x20))
- count++;
- countAll++;
- }
- countAll -= count;
- if (countAll == 0 || (countAll == 1 && x[0] & 0x20))
- {
- for (short unsigned i = 1; i < countAll + count; ++i)
- {
- x[i] ^= 32;
- }
- x[0] &= ~32;
- }
- std::cout << x;
- }
Advertisement
Add Comment
Please, Sign In to add comment