#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>

int main(){
  while(true){
    std::string red, green, bottom, right;
    std::cin >> red;
    if (red.compare("-") == 0) return EXIT_SUCCESS;
    std::cin >> green;
    std::cin >> bottom;
    right.clear();
    auto c_red = red.begin();
    auto c_green = green.begin()+1;
    auto center = *(green.begin());
    for(auto i=bottom.begin(); i!=bottom.end(); i++){
      while(center!=*i){
        right.push_back(center);
        center = *c_green;
        c_green++;
      }
      center = *c_red;
      c_red++;
    }
    while(c_green!=green.end()){
      right.push_back(center);
      center = *c_green;
      c_green++;
    }
    right.push_back(center);
    std::cout << right << std::endl;
  }
}
