Advertisement
sherry_ahmos

Untitled

May 5th, 2022
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <iostream>
  2. #include <sstream>
  3. #include <cstdlib>
  4. #include <algorithm>
  5. #include <cmath>
  6. #include <iomanip>
  7. #include <numeric>
  8. #include <vector>
  9. #include <string>
  10. #include <set>
  11. #include <map>
  12.  
  13. using namespace std;
  14. #define ll long long
  15. void sherry()
  16. {
  17.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  18. #ifndef ONLINE_JUDGE
  19.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  20. #endif
  21. }
  22. bool comp(pair<int, int> a, pair<int, int> b)
  23. {
  24.     return a.second < b.second;
  25. }
  26. int main()
  27. {
  28.     sherry();
  29.     string s;
  30.     map<char, int> m;
  31.     vector<char> v(0);
  32.     cin >> s;
  33.     for (ll i = 0; i < s.size(); i++)
  34.     {
  35.         if (m[s[i]] == 0)
  36.         {
  37.             m[s[i]]++;
  38.             v.push_back(s[i]);
  39.         }
  40.         else
  41.         {
  42.             m[s[i]] = 0;
  43.             auto it = find(v.begin(), v.end(), s[i]);
  44.             v.erase(it);
  45.         }
  46.     }
  47.     for (auto &i : v)
  48.     {
  49.         cout << i;
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement