#include <bits/stdc++.h>
using namespace std;
int n, vtc, vtd, i, j;
string S, noidung, xaucon, xaudao;
int main()
{
    ios_base::sync_with_stdio (false);
    cin.tie(0);    cout.tie(0);
    freopen("GIAIMA.INP", "r", stdin);
    freopen("GIAIMA.OUT", "w", stdout);
    cin >> n;
    cin >> S;
    S = S + " ";
    noidung = "";
    xaucon = "";
    vtc = 0;
    for (i = 0; i < S.size(); i++)
    {
        vtd = vtc;
        if (S[i] >= 'a' && S[i] <= 'z')
            xaucon = xaucon + S[i];
        else
        {
            vtc = i;
            if (S[vtd] == '1')
                xaucon = xaucon;
            else if (S[vtd] == '0')
            {
                xaudao = "";
                j = xaucon.size() - 1;
                while (j >= 0)
                {
                    xaudao = xaudao + xaucon[j];
                    j = j - 1;
                }
                xaucon = xaudao;
            }
            noidung = noidung + xaucon + " ";
            xaucon = "";
        }
    }
    noidung = noidung.substr(0, noidung.length()-1 );
    int i=0;
    while(i<noidung.length()-1)
    {
        if (noidung[i]==' '&&noidung[i+1]==' ')
        {
            noidung.erase(i,1);
            i--;
        }
        i++;
    }
    if (noidung[0]==' ') noidung.erase(0,1);
    cout << noidung;
    return 0;
}
