Advertisement
MiinaMagdy

Palindrome Required

Sep 9th, 2021
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.37 KB | None | 0 0
  1. /*                                    
  2.            .@@@@@@@@   @@@                                              @@       @@
  3.        ,@@@@@@     @@ .@@@      @@    @@@        @@@%@@@@.   @@@        @@  @@  @@@@/      @@@
  4.        /& @@@@    @@@ *@@@     @@@#  @@@&@@@    @@@@@@@#&@@ @@@%&,      @@ @@@@  @@@@    @@@&
  5.           @@@  .@@@   /@%@     @@@  @@@@   @@& .@@@         @@&&&@      @@ @@@@  (@@@@ @@@@
  6.          %@@@@@@&     /&&&     %@&  @&@     @& @&@&         &&@#%@%.   &@@ &@&#   %@@@@@@
  7.          @@@@@        /@&%(%&@@@&@  @&&    ,@@ @@&&@@&@@@   &@@ /@@&/  @@, @@@/    %@@@(
  8.          @@@.         *@@@@#,  @@@  @@@   ,@@  @@@.         @@@   @@@@@@@  %@@/   @@@@@@%
  9.          @@@          *@@%     @@@   @@@@@@#    @@@@@@@@@@  @@@    ,@@@@    @@& .@@@  @@@@
  10.          &@@,          @@%      @@                          @@@                 @@      @@@
  11.                                                              &*
  12.  */
  13. #include <bits/stdc++.h>
  14. // #include "phoenix.h"
  15. #define ceil(n, m) (((n) / (m)) + ((n)%(m) ? 1 : 0))
  16. #define endl "\n"
  17. #define NumOfDig(n) log10(n) + 1
  18. #define MOD 1000000007
  19. #define INF 2000000000
  20. #define Time cerr << "Time Taken: " << (float)clock() / CLOCKS_PER_SEC << " Secs" << "\n";
  21. #define EPS 1e-9
  22. #define PI1 acos(-1)
  23. #define PI2 3.141592653
  24. #define all(s) s.begin(), s.end()
  25. #define rall(s) s.rbegin(), s.rend()
  26. // #define getline(s) getline(cin >> ws, s)
  27.  
  28. using namespace std;
  29.  
  30. typedef long long ll;
  31. typedef unsigned long long ull;
  32.  
  33. /**
  34.  * @author MiinaMagdy 😌🙋‍♂️
  35.  * @remark Time limit - memory limit (efficiency)
  36.  * @remark (OVERFLOW) long long
  37.  * @remark freopen() file
  38.  * @remark (CORNER) test case
  39.  * @remark division by (ZERO) || Out of array's (RANGE)
  40.  * @remark use logarithm if you want to compare two products
  41.  */
  42.  
  43. void phoenix()
  44. {
  45.     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  46.     #ifndef ONLINE_JUDGE
  47.         freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  48.     #endif
  49.     Time
  50. }
  51.  
  52.  
  53. int main(void)
  54. {
  55.     phoenix();  
  56.     ll testcases = 1;
  57.     // cin >> testcases;
  58.     while (testcases--)
  59.     {
  60.         string s;
  61.         cin >> s;
  62.         map<char, int> freq;
  63.         for (auto & i : s) freq[i]++;
  64.         int cnt = 0;
  65.         for (auto & i : freq) {
  66.             cnt += (i.second%2);
  67.         }
  68.         cout << max(0, cnt - 1) << endl;
  69.     }
  70.     return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement