import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner jin = new Scanner(System.in);
		while (jin.hasNext()) {
			String pre = jin.next(), mid = jin.next();
			Node root = new Node(pre);
			root.build(pre, mid);
			root.post();
			System.out.println();
		}
	}
}

class Node {
	char entry;
	Node lson;
	Node rson;

	public Node(String pre) {
		entry = pre.charAt(0);
		lson = null;
		rson = null;
	}

	public void build(String pre, String mid) {
		if (pre.length() > 1) {
			int p = mid.indexOf(entry);
			String lmid = mid.substring(0, p);
			String rmid = mid.substring(p + 1);
			String lpre = pre.substring(1, 1 + lmid.length());
			String rpre = pre.substring(1 + lmid.length());
			if (lpre.length() > 0) {
				lson = new Node(lpre);
				lson.build(lpre, lmid);
			}
			if (rpre.length() > 0) {
				rson = new Node(rpre);
				rson.build(rpre, rmid);
			}
		}
	}

	public void post() {
		if (lson != null)
			lson.post();
		if (rson != null)
			rson.post();
		System.out.print(entry);
	}
}
/**************************************************************
	Problem: 2121
	User: admin
	Language: Java
	Result: Accepted
	Time:616 ms
	Memory:39984 kb
****************************************************************/