#!/usr/bin/ruby
#
# 1036.rb: Monster Factory
#

### main

loop do
  red = gets.strip
  break if red == '-'

  red = red.split('')
  green = gets.strip.split('')
  down = gets.strip.split('')
  #p [red, green, down]

  right = []
  c = green.shift

  while ! red.empty? || ! green.empty?
    if c == down.first
      c = red.shift
      down.shift
    else
      right << c
      c = green.shift
    end
  end

  right << c

  puts right.join
end