var a:array[1..100000] of char;
i,j,n,len,m,p,q,x,y:longint;
ch:char;
function getnum(x:longint;var pos:longint):longint;
var k,t,i:longint;
begin
i:=x;
t:=0;
while a[i] in ['0'..'9'] do
begin
t:=t*10+ord(a[i])-ord('0');
inc(i);
end;
pos:=i;
getnum:=t;
end;
function make(x:longint):longint;
var i,j,k,t,delta,pos:longint;
begin
i:=x;
while true do
begin
if a[i]=']' then exit(i);
if a[i]<>'[' then write(a[i])
else
begin
k:=getnum(i+1,pos);
for j:=1 to k do
begin
t:=make(pos);
end;
i:=t;
end;
inc(i);
end;
end;
begin
assign(input,'passworda.in');
reset(input);
assign(output,'passworda.out');
rewrite(output);
len:=0;
while not(eoln) do
begin
inc(len);
read(ch);
a[len]:=ch;
end;
a[LEN+1]:=']';
make(1);
writeln;
close(Input);
close(output);
end.