package com.company; import java.util.Scanner; public class Main {  public static String strGame(String str){  if(str==null||str.length()<=0) return str;
            String new_str=""; int index[]={0};
            String res=getStr(str,index); for(int i=0;i<res.length();i++)
                new_str=res.charAt(i)+new_str; return new_str;
        } public static String getStr(String str,int re_index[]){ if(str==null||str.length()<=0) return str; int index=re_index[0];
            String res="";
            String num=""; while(index<str.length()){ if(str.charAt(index)>='0'&&str.charAt(index)<='9'){
                    num=num+str.charAt(index);
                    index++;
                } else if(str.charAt(index)==')'||str.charAt(index)==']'||str.charAt(index)=='}') {
                    re_index[0]=index+1; return res;
                } else if(str.charAt(index)=='('||str.charAt(index)=='['||str.charAt(index)=='{'){
                    re_index[0]=index+1;
                    String repeat=getStr(str,re_index);
                    index=re_index[0]; int n=Integer.valueOf(num);
                    num=""; while(n>0){
                        res+=repeat;
                        n--;
                    }
                } else{
                    res+=str.charAt(index);
                    index++;
                }
            } return res;
        } public static void main(String[] args) { // write your code here  Scanner sc = new Scanner(System.in);
            String str = sc.nextLine(); ///abc3(A4(b))  str=strGame(str);
            System.out.print(str);
        }
    }