#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
string a, b, c;
int main() {
	while (cin >> a, a != "-") {
		cin >> b >> c;
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		char r = b.back(); b.pop_back();
		string ret;
		while (true) {
			if (c.find(r) != string::npos) {
				if (a.size() == 0) break;
				r = a.back(); a.pop_back();
			}
			else {
				ret += r;
				if (b.size() == 0) break;
				r = b.back(); b.pop_back();
			}
		}
		cout << ret << endl;
	}
	return 0;
}