first = input().split("|") second = input().split("|") print(first[0] + second[0] + " " + first[1] + second[1])