#include <bits/stdc++.h>
using namespace std;

queue<char> to_queue(string s) {
    queue<char> q;
    for (int i=0; i<(int)s.size(); ++i) {
        q.push(s[i]);
    }
    return q;
}

int main() {
    string red, green, down;
    while (cin >> red, red != "-") {
        cin >> green >> down;

        queue<char> r, g, d;
        r = to_queue(red);
        g = to_queue(green);
        d = to_queue(down);
        
        string res = "";
        char c = g.front(); g.pop();
        while ( ! r.empty() || ! g.empty() ) {
            if (c == d.front()) {
                d.pop();
                c = r.front(); r.pop();
            } else {
                res += c;
                c = g.front(); g.pop();
            }
        }
        res += c;
        cout << res << endl;
    }
    return 0;
}
