import java.util.*;
import java.io.*;

class Main {

   Scanner in;
   PrintWriter out;

   final String INPUT_FILE_NAME = "input.txt";
   final String OUTPUT_FILE_NAME = "output.txt";

   int getNum(String line) {
      int num = 0;
      for (int i = line.length() - 1; i >= 0; i--) {
         if (line.charAt(i) == '}') {
            num++;
         } else {
            break;
         }
      }
      return num - 1;
   }

   StringBuilder sb = new StringBuilder();
   
   void createNum(int res) {
      if (res == 0) {
         sb.append("{}");

      } else {
         sb.append(",");
         sb.append("{");
         for (int i = 0; i < res; i++) {
            
            createNum(i);
         }
         sb.append("}");

      }
   }

   void solve() {
      String line1 = in.nextLine();
      String line2 = in.nextLine();
      int x1 = getNum(line1);
      int x2 = getNum(line2);
      createNum(x1 + x2);
      if (sb.length()==2){
         out.print(sb);
         return;
      }
      for (int i = 1; i < sb.length(); i++){
         out.print(sb.charAt(i));
      }
   }

   void run() {
      try {
         in = new Scanner(new FileReader(INPUT_FILE_NAME));
         out = new PrintWriter(OUTPUT_FILE_NAME);
      } catch (IOException e) {
         throw new Error(e);
      }
      try {
         solve();
      } finally {
         out.close();
      }
   }

   public static void main(String[] args) {
      new Main().run();

   }
}

// class Scanner {
// StreamTokenizer in;
//
// Scanner(Reader r) {
// in = new StreamTokenizer(new BufferedReader(r));
// in.resetSyntax();
// in.whitespaceChars(0, 32);
// in.wordChars(33, 255);
// }
//
// String next() {
// try {
// in.nextToken();
// return in.sval;
// } catch (Exception e) {
// throw new Error();
// }
// }
//
// double nextDouble() {
// return Double.parseDouble(next());
// }
//
// int nextInt() {
// return Integer.parseInt(next());
// }
//
// long nextLong() {
// return Long.parseLong(next());
// }
// }
