#include<cstring>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
using namespace std;
int n;
int f[30000];
int stack[10000];
string str;
void recursive(int l,int r){
int i=l;
int j=0;
while (i<=r){
while (str[i]-'A'<26 && str[i]-'A'>=0){
//printf("%c",str[i]);
cout<<str[i];
i++;
}
if (str[i]=='['){
j=i;
int multi=0;
while (str[++i]-'0'<10 && str[i]-'0'>=0)
multi=multi*10+str[i]-'0';
for (;multi>0;multi--)
recursive(i,f[j]-1);
i=f[j]+1;
}
}
}
int main()
{
freopen("passworda.in","r",stdin);
freopen("passworda.out","w",stdout);
cin>>str;
int top=0;
int tmp=str.size();
for (int i=0;i<str.size();i++){
if (str[i]=='[')
stack[++top]=i;
if (str[i]==']')
f[stack[top--]]=i;
}
recursive(0,str.size()-1);
return 0;
}