#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
string s,a;
string dfs(int l,int r)
{
int ll =0;
for (ll = l+1;ll <= r-1;ll++)//里面有没有嵌套
if (s[ll]=='[')
break;
if (ll==r)
{
int x = 0,i;
for (i = l+1;i <= r-1;i++)
if (s[i]>='0' && s[i] <= '9')
x = x*10+s[i]-'0';
else break;
string t = s.substr(i,r-i);
string ss = "";
for (i = 1;i <= x;i++)
ss+=t;
return ss;
}
}
int main()
{
freopen("passworda.in","r",stdin);
freopen("passworda.out","w",stdout);
cin >> s;
int len = s.size();
for (int i = 0;i <= len-1;i++)
if (s[i]=='[')
{
int j = i+1;
int t = 1;
while (j <= len-1 && t!=0)
{
if (s[j]=='[') t++;
if (s[j]==']') t--;
if (t==0) break;
j++;
}
//i..j是一个待展开的东西
cout << dfs(i,j);
i = j;
}
else
putchar(s[i]);
return 0;
}