def re(s, a, b):
    s = s.replace(a, b)
    return s
while True:
    try:
        ls = list(input().split())
        n = input()
        print(re(re(n, ls[1], ls[2]), ls[3], ls[4]))
    except:
        break