fulldouble=input().split()
string1=fulldouble[0]
string2=fulldouble[1]
count=0
for x in string1:
  if count+1==len(string1):
    break
  if string1[count+1]==x:
    string1=string1[:count+1]+string1[count+1:count+2].replace(x," ")+string1[count+2:]
  count+=1
count=0
string1=string1.replace(" ","")
for x in string2:
  if count+1==len(string2):
    break
  if string2[count+1]==x:
    string2=string2[:count+1]+string2[count+1:count+2].replace(x," ")+string2[count+2:]
  count+=1
string2=string2.replace(" ","")

#print("After Rule1")
#print(string1)
#print(string2)


first=string1[0]
rest=string1[1:].replace("A","").replace("E","").replace("I","").replace("O","").replace("U","")
string1=first+rest
first=string2[0]
rest=string2[1:].replace("A","").replace("E","").replace("I","").replace("O","").replace("U","")
string2=first+rest

#print("After Rule2")
#print(string1)
#print(string2)

while len(string1)>len(string2):
  string2=string2+" "
while len(string1)len(string2):
  string2=" "+string2
while len(string1)len(string2):
  print(string2)
else:
  fulldouble=[string1,string2]
  fulldouble.sort()
  print(fulldouble[0])
  
#to left align, just use the same index for each
#to right align, add spaces to left until strings are same length
#or to right align, loop from right instead