ouef = input()
ief = ouef.split(" ")
inputa = ief[0]
inputb = ief[1]
def step1(input1):
    input1 = input1.replace("BB","B")
    input1 = input1.replace("CC","C")
    input1 = input1.replace("DD","D")
    input1 = input1.replace("FF","F")
    input1 = input1.replace("GG","G")
    input1 = input1.replace("HH","H")
    input1 = input1.replace("JJ","J")
    input1 = input1.replace("KK","K")
    input1 = input1.replace("LL","L")
    input1 = input1.replace("MM","M")
    input1 = input1.replace("NN","N")
    input1 = input1.replace("PP","P")
    input1 = input1.replace("QQ","Q")
    input1 = input1.replace("RR","R")
    input1 = input1.replace("SS","S")
    input1 = input1.replace("TT","T")
    input1 = input1.replace("VV","V")
    input1 = input1.replace("WW","W")
    input1 = input1.replace("XX","X")
    input1 = input1.replace("YY","Y")
    input1 = input1.replace("ZZ","Z")
    return input1
inputa = step1(inputa)
inputb = step1(inputb)
#step1 works
def step2(input2):
    if input2[0] in ["A"]:
        input2 = input2.replace("A", "")
        input2 = input2.replace("E", "")
        input2 = input2.replace("I", "")
        input2 = input2.replace("O", "")
        input2 = input2.replace("U", "")
        input2 = "A" + input2
    elif input2[0] in ["E"]:
        input2 = input2.replace("A", "")
        input2 = input2.replace("E", "")
        input2 = input2.replace("I", "")
        input2 = input2.replace("O", "")
        input2 = input2.replace("U", "")
        input2 = "E" + input2
    elif input2[0] in ["I"]:
        input2 = input2.replace("A", "")
        input2 = input2.replace("E", "")
        input2 = input2.replace("I", "")
        input2 = input2.replace("O", "")
        input2 = input2.replace("U", "")
        input2 = "I" + input2
    elif input2[0] in ["O"]:
        input2 = input2.replace("A", "")
        input2 = input2.replace("E", "")
        input2 = input2.replace("I", "")
        input2 = input2.replace("O", "")
        input2 = input2.replace("U", "")
        input2 = "O" + input2
    elif input2[0] in ["U"]:
        input2 = input2.replace("A", "")
        input2 = input2.replace("E", "")
        input2 = input2.replace("I", "")
        input2 = input2.replace("O", "")
        input2 = input2.replace("U", "")
        input2 = "U" + input2
    else:
        input2 = input2.replace("A", "")
        input2 = input2.replace("E", "")
        input2 = input2.replace("I", "")
        input2 = input2.replace("O", "")
        input2 = input2.replace("U", "")
    return input2
inputa = step2(inputa)
inputb = step2(inputb)
#step2 works
la = list(inputa)
lb = list(inputb)
length = 0
b = 0
if len(la)> len(lb):
    length = len(lb)
if len(lb)>=len(la):
    length = len(la)
for x in range(length):
  if la[x-b] == lb[x-b]:
    del la[x-b]
    del lb[x-b]
    b+=1
inputa = "".join(la)
inputb = "".join(lb)
#step3 works

la = list(inputa)
lb = list(inputb)
length = 0
if len(la)> len(lb):
    length = len(lb)
if len(lb)>=len(la):
    length = len(la)
la.reverse()
lb.reverse()

b = 0
for x in range(length):
    if la[x-b] == lb[x-b]:
        del la[x-b]
        del lb[x-b]
        b+=1
if la != (""):
    la.reverse()
if lb!= (""):
    lb.reverse()
inputa = "".join(la)
inputb = "".join(lb)
#step4 works
pink = []
pink.append(inputa)
pink.append(inputb)
pink.sort()
if len(inputa) < len(inputb):
  print(inputa)
elif len(inputb) < len(inputa):
  print(inputb)
elif len(inputb) == len(inputa):
  print(pink[0])