#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
    string s;
    vector<char> ch;
    while(cin>>s)
    {
        int len1=s.size();
        for(int i=0;i<len1;i++)
        {
            if(s[i]=='0')
            {
                ch.push_back('0');
            }
            else if(s[i]=='1')
            {
                ch.push_back('1');
            }
            else if(!ch.empty())
            {
                ch.pop_back();
            }
        }
        int len2=ch.size();
        for(int i=0;i<len2;i++)
        {
            cout<<ch[i];
        }
        cout<<endl;
    }
    return 0;
}