#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
  string top;
  while(cin >> top, top != "-"){
    string left, right, res;
    cin >> left >> res;

    char center = left[0];
    left.erase(0, 1);
    while(!top.empty() || !left.empty()){
      if(res.find(center, 0) == string::npos && !left.empty()){
	right.push_back(center);
	center = left[0];
	left.erase(0, 1);
      }else if(!top.empty()){
	center = top[0];
	top.erase(0, 1);
      }
    }
    if(res.find(center, 0) == string::npos) right.push_back(center);

    cout << right << endl;
  }
  return 0;
}