#include<algorithm>
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
ifstream fin("passworda.in");
ofstream fout("passworda.out");
int n;
int f[30000]={0};
int t[10000]={0};
string s;
void tryy(int l,int r)
{
int i=l,j=0;
while (i<r)
{
while (s[i]-'A'<26 && s[i]-'A'>=0)
{
fout<<s[i];
i++;
}
if (s[i]=='[')
{
j=i;
int g=0;
while (s[++i]-'0'<10 && s[i]-'0'>=0)
g=g*10+s[i]-'0';
for (;g>0;g--)
tryy(i,f[j]-1);
i=f[j]+1;
}
}
}
int main()
{
fin>>s;
int tou=0;
for (int i=0;i<s.size();i++)
{
if (s[i]=='[') t[++tou]=i;
if (s[i]==']') f[t[tou--]]=i;
}
tryy(0,s.size()-1);
fin.close();
fout.close();
return 0;
}