import sys
whileTrue:
line = sys.stdin.readline().strip()#当没有内容时,退出if line =="":break#开始遍历入栈
stack =[]for s in line:#在没有遇到右括号的时候,一值入栈,遇到右括号开始对【】内的信息解压缩if s !="]":
stack.append(s)else:#创建两个变量 temp:存放字符 和times :存放数字:
temp =''#在弹出的时候,遇到|之前的信息都是需要复制的字符串while stack and stack[-1]!="|":
temp = stack.pop()+ temp
#弹出:|
stack.pop()
times =""#注意这里面的数可能是两位以上的while stack and stack[-1].isdigit():
times = stack.pop()+ times
#弹出 ”【“
stack.pop()
stack.append(int(times)*temp)print("".join(stack))