注意多文件输入即可,答案间需要换行


using namespace std;

int main()
{
    string a;
    while(cin>>a)
    {
    stack<char> st;
    for(int i=0;i<a.size();i++)
    {
        char c=a[i];
        if(st.empty())
        {
            st.push(c);
        }
        else if(c=='o'&&st.top()=='o')
        {
            st.pop();
            if(!st.empty()&&st.top()=='O')
            {
                st.pop();
            }
            else st.push('O');
        }
        else if(st.top()=='O'&&c=='O')
        {
            st.pop();
        }
        else
        {
            st.push(c);
        }
    }
    stack<char> ans;
    while(!st.empty())
    {
        ans.push(st.top());
        st.pop();
    }
    while(!ans.empty())
    {
        cout<<ans.top();
        ans.pop();
    }
        cout<<endl;
    }
    return 0;
}