#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 100001
#define eps 1e-9
const int inf=0x7fffffff; //无限大
string s;
vector<char> a;
int kiss;
int i;
void dealk()
{
void deal(char c);
int start=i;
while(1)
{
i++;
if(s[i]==']')
{
if(a[kiss]==0)
{
break;
}
else
{
i=start;
continue;
}
}
deal(s[i]);
}
}
void deal(char c)
{
if(c=='+')
a[kiss]++;
if(c=='-')
a[kiss]--;
if(c=='>')
{
kiss++;
if(kiss>=a.size())
a.push_back(0);
}
if(c=='<')
{
kiss--;
if(kiss<0)
{
a.insert(a.begin(),i);
kiss=0;
}
}
if(c=='.')
{
int m=a[kiss];
printf("%c",m);
}
if(c==',')
{
char k;
scanf("%c",&k);
s[kiss]=k;
}
if(c=='[')
{
dealk();
}
/*
for(int i=0;i<a.size();i++)
printf("%d",a[i]);
cout<<endl;
*/
}
int main()
{
while(cin>>s)
{
a.push_back(0);
int kiss=0;
for(i=0;i<s.size();i++)
{
deal(s[i]);
}
}
return 0;
}