#include<bits/stdc++.h>
using namespace std;
string y;
int x=0;
string f()
{
string a="",b="";
char c;
int d=0;
while(x<=y.size())
{
c=y[x];
x++;
if(c=='[')
{
d=y[x]-48;
x++;
a=f();
while(d--)
{
b=b+a;
}
}
else if(c==']')
{
return b;
}
else b=b+c;
}
}
int main()
{
cin>>y;
cout<<f();
return 0;
}