#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
cin>>s;
for(int i=0;i<=s.size()-1;i++){
if(s[i]=='['){
int t=1;
string a;
while(s[i]!=']'){
if(s[i]>='A'&&s[i]<='Z')
a+=s[i];
else
if(s[i]>='0'&&s[i]<='9'&&s[i+1]>='0'&&s[i+1]<='9'){
t*=(s[i]-'0')*10+(s[i+1]-'0');
i++;
}
else
if(s[i]>='0'&&s[i]<='9')
t*=(s[i]-'0');
i++;
}
for(int i=1;i<=t;i++)
cout<<a;
while(s[i]==']')
i++;
}
else
cout<<s[i];
}
return 0;
}