paradox64ce

TheWireUs-Day5

Sep 22nd, 2020
861
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     string s;
  8.     cin >> s;
  9.     stack<char> st;
  10.     for (ll i = 0; i < s.length(); i++)
  11.     {
  12.         if (st.empty() || st.top() != s[i])
  13.         {
  14.             st.push(s[i]);
  15.             cout << s[i];
  16.         }
  17.         else
  18.         {
  19.             cout << "*";
  20.         }
  21.     }
  22.  
  23.     return 0;
  24. }
RAW Paste Data