#include<bits/stdc++.h>
using namespace std;
string y = "";
int len=0;
string jy(int i) {
string ans = "";
if (y[i] == '[') {
int t=0;
i++;
while(y[i]<'9'&&y[i]>'0'){
t=t*10+y[i]-'0';
i++;
}
string a = jy(i);
for (int i = 1; i <= t; i++) {
ans += a;
}
return ans;
} else {
int j = i;
while (y[j] != ']') {
ans += y[j];
j++;
}
len=j;
//cout<<ans<<endl;
return ans;
}
}
int main() {
cin >> y;
for (int i = 0; i < y.size(); i++) {
char a = y[i];
if (a == ']')continue;
if (a == '\n' || a == ' ')continue;
if (a != '[') {
cout << a;
} else {
cout << jy(i);
i+=len;
}
}
}