#include<bits/stdc++.h>
using namespace std;
string f;
void dg(string g){
int i=0,k=0,l=-1,r;
for(int j=0;j<g.size();j++){
if(g[j]=='['){
l = j;
break;
}
}
for(int j=g.size()-1;j>=0;j--){
if(g[j]==']'){
r = j;
break;
}
}
if(l==-1){
cout<<g;
return ;
}else{
int t = 0;
if(g[l+2]>='0'&&g[l+2]<='9'){
t=g[l+2]-'0'+10*(g[l+1]-'0');
i=l+2;
}else{
t=g[l+1]-'0';
i=l+1;
}
string b="";
for(int j=i+1;j<=r-1;j++){
b+=g[j];
}
for(int j=0;j<l;j++){
cout<<g[j];
}
for(int j=0;j<t;j++){
dg(b);
}
for(int j=r+1;j<g.size();j++){
cout<<g[j];
}
}
}
int main(){
cin>>f;
dg(f);
return 0;
}