# include <stdio.h>
# include <stdlib.h>
# include <string.h>
int i=0;
char a[30000];
char* digui();
char* digui ()
{
i++;
int n;
int j=0;
char str[30000];
while (i < strlen(a))
{
if (a[i] >= '0' && a[i] <= '9')
{
if (a[i+1] >= '0' && a[i+1] <= '9')
{
n = (a[i] - '0') * 10 + (a[i+1] - '0');
i++;
}
else
{
n = (a[i] - '0');
}
}
else if (a[i] == '[')
{
char temp[30000];
strcpy(temp,digui());
int num=strlen(str);
for (int z=0;z<strlen(temp);z++)
{
str[z+num] = temp[z];
}
}
else if (a[i] == ']')
{
int temp = strlen(str);
int temp2 = 0;
int length = strlen(str);
for (int z=length;z<n*length;z++)
{
str[temp] = str[temp2];
temp++;
temp2++;
}
return str;
}
else
{
str[j] = a[i];
j++;
}
i++;
}
return str;
}
int main (void)
{
scanf ("%s",a);
while (i < strlen(a))
{
if (a[i] == '[')
{
printf ("%s",digui());
}
else
{
printf ("%c",a[i]);
}
i++;
}
return 0;
}