Advertisement
sherry_ahmos

Untitled

May 8th, 2022
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.07 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. #include <stack>
  13. #include <deque>
  14. #include <unordered_map>
  15. #include <bits/stdc++.h>
  16. #include <queue>
  17.  
  18. using namespace std;
  19. #define ll long long
  20. void sherry()
  21. {
  22.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  23. #ifndef ONLINE_JUDGE
  24.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  25. #endif
  26. }
  27. bool comp(pair<int, int> a, pair<int, int> b)
  28. {
  29.     return a.second > b.second;
  30. }
  31. ll fac(ll t)
  32. {
  33.     if (t == 1)
  34.     {
  35.         return 1;
  36.     }
  37.     return t * fac(t - 1);
  38. }
  39. int main()
  40. {
  41.     sherry();
  42.     string s;
  43.     cin >> s;
  44.     stack<char> st;
  45.     st.push(s[0]);
  46.     for (int i = 1; i < s.size(); i++)
  47.     {
  48.         if (s[i] == st.top())
  49.             st.pop();
  50.         else
  51.             st.push(s[i]);
  52.     }
  53.     if (st.empty())
  54.         cout << "Yes";
  55.     else
  56.         cout << "No";
  57.     return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement