Advertisement
AmidamaruZXC

TaskN

Apr 24th, 2021
805
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. bool isPal(string str)
  7. {
  8.     int count[256] = { 0 };
  9.  
  10.     for (int i = 0; str[i]; i++)
  11.         count[str[i]]++;
  12.  
  13.     int odd = 0;
  14.     for (int i = 0; i < 256; i++)
  15.     {
  16.         if (count[i] & 1)
  17.             odd++;
  18.         if (odd > 1)
  19.             return false;
  20.     }
  21.  
  22.     return true;
  23. }
  24.  
  25. int main() {
  26.     string str;
  27.     cin >> str;
  28.  
  29.     if (isPal(str))
  30.         cout << "ZA WARUDO TOKI WO TOMARE" << endl;
  31.     else
  32.         cout << "JOJO" << endl;
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement