#include<iostream> #include<stack> using namespace std; const int maxn = 1000010; int main() { string s; while(cin>>s){ stack<char>st; char arr[maxn]; for (int i = 0; i < s.size(); i++) { if (st.empty()) { st.push(s[i]); continue; } if (s[i] == 'o') { if (st.top() == 'o') { st.pop(); //st.push('O'); if (!st.empty()&&st.top() == 'O') { st.pop(); } else { st.push('O'); } } else { st.push('o'); } } else { if (st.top() == 'O')st.pop(); else st.push('O'); } } int l = 1; while (!st.empty()) { arr[l++] = st.top(); st.pop(); } for (int i = l-1; i >= 1; i--) { cout << arr[i]; } cout<<endl; } return 0; }