#include <iostream>
#include <string>

using namespace std;

int l1, l2;
string s1, s2, res;

string func(char cn, string str1, string str2, int p, int q, int l)
{
  if(p >= l1 && q >= l2){
    str2 += cn;
    return str2;
  }

  if(l < res.size() && cn == res[l]) return func(s1[p], (str1+cn), str2, p+1, q, l+1);
  return func(s2[q], str1, (str2+cn), p, q+1, l);
}

int main()
{
  while(cin>>s1 && s1 != "-"){
    cin >> s2 >> res;
    l1 = s1.size();
    l2 = s2.size();

    cout << func(s2[0], "", "", 0, 1, 0) << endl;
  }

  return 0;
}