# -----------------------------------------------------------------------------------------
# Oak Valley Coding Club 2019-2020
# Solution for 2020 ACSL Programming Problem #2 – Junior Division
# Author :  Harsha Ganta
# Language: Python 3.x
# -----------------------------------------------------------------------------------------


#-----------------------------------------------
# Main Functions to solve the problem

#function to remove double consonants of the consequtive consants
def remove_double_cons(S):
    count = 0
    for i in range(0,len(S)-1):
        if S[i] == S[i+1]:
            S[i+1] = ' '
            count = count+1
    while count>0:
        S.remove(' ')
        count = count-1
    return S

#function to remove vowels unless first character is a vowel
def remove_vowels(S):
    vowels = ['A','E','I','O','U']
    count = 0
    for x in range(len(S)):
        if S[x] in vowels:
            #replaces vowels with spaces but skip the first character is a vowel
            if x>0:
                S[x] = ' '
                count = count+1
    #removes spaces for the number of spaces(count)
    while count>0:
        S.remove(' ')
        count=count-1
    return S

#function to find shortest list and sorts the string
def find_shortest(S1,S2):
    if len(S1) > len(S2):
        S =(S2)
    if len(S1) < len(S2):
        S = (S1)
    if len(S1) == len(S2):
        str = [S1, S2]
        str.sort()
        S = str[0]
    return S

#MAIN function to eliminate 
def eliminate(S1,S2):
    listS1 = list(S1)
    listS2 = list(S2)

    listS1 = remove_double_cons(listS1)
    listS2 = remove_double_cons(listS2)

    listS1 = remove_vowels(listS1)
    listS2 = remove_vowels(listS2)

    S = find_shortest(listS1,listS2)

    count = 0
    for x in range(0,(len(S)-1)):
        if listS1[x] == listS2[x]:
            listS1[x] = ' '
            listS2[x] = ' '
            count = count+1
    while count>0:
        listS1.remove(' ')
        listS2.remove(' ')
        count = count-1
            
    S = find_shortest(listS1, listS2)

    count = 0
    for x in range(1,len(S)):
        if listS1[-x] == listS2[-x]:
            listS1[-x] = ' '
            listS2[-x] = ' '
            count = count + 1
    while count>0:
        listS1.remove(' ')
        listS2.remove(' ')
        count = count-1

    S = find_shortest(listS1, listS2)

    S = (''.join(S))
    
    return S


#-----------------------------------------------
# Auxiliary code for reading input and writing output
input = 'input.txt'
output = 'output.txt'

def readinput():
  words=[]
  with open(input) as f:
    lines = f.readlines()
    for line in lines:
      if line.split()!=[]:
        words.append(line.split())

  for j in range (0,len(words)):
    for i in range(0,len(words[j])):
      words[j][i]=(words[j][i])

  return words


def writeoutput(line):
  with open(output,'a') as f:
     f.write(str(line)+'\n')

def clearoutput():
  f=open(output,'w')
  f.write('')

allinputs = readinput()

clearoutput()
for line in allinputs:
    S1 = line[0]
    S2 = line[1]
    writeoutput(eliminate(S1, S2))
    print(eliminate(S1,S2))