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


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

def Remove_Vowels(word):
    letters = []                                 # make an empty list to hold the non-vowels
    i = 0
    for char in word:                            # for each character in the word
        if i != 0:                               # if it is not the first letter
            if char.lower() not in 'aeiou':      # if the letter is not a vowel
                letters.append(char)             # add it to the list of non-vowels
        else:                                    # if it is the first letter, simply append
            letters.append(char)                 # add it to the list of non-vowels
        i = i + 1
    #print("Removing Vowels:", ''.join(letters))
    return ''.join(letters)                      # join the list of non-vowels together into a string


def find_shorterLength(S1,S2):
     if len(S1) < len(S2):
         return len(S1)
     else:
         return len(S2)

def Remove_Double_Consonants(str1):
    listS1 = []
    #print("\nRemoving Double Consonants")
    #print ("before:", str1)
    for s in str(str1):
        listS1.append(s)
    #Now you can go through the list and modify it:
    for i in range(0, len(listS1)-1):
    #    print(listS1[i])
        if listS1[i] == listS1[i + 1]:
            listS1[i+1]=''
    # replace  listS1[i+1] with space or some other special character
    # you can later remove these

    str3 = " "
    str4 = (str3.join(listS1))
    str5 = str4.replace(' ', '')
    #print ("after:", str5)
    return str5;



#-----------------------------------------------
# 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('')

################ MAIN PROGRAM #######

input = readinput()

clearoutput()
for line in input:
    S1 = line[0]
    S2 = line[1]
    S1 = Remove_Double_Consonants(S1)      #remove double consonants - S1
    S1 = Remove_Vowels(S1)                 #remove vowels
    S2 = Remove_Double_Consonants(S2)      #remove double consonants - S2
    S2 = Remove_Vowels(S2)                 #remove vowels

    #print("\nRemoving left aligned matches between", S1, "and", S2)
    iterations = find_shorterLength(S1, S2)

    # convert to lists and find matches, remove them
    listS1 = []
    listS2 = []
    for s in str(S1):
        listS1.append(s)
    for s in str(S2):
        listS2.append(s)

    x = 0
    for i in range(0, iterations):
        if listS1[i] == S2[i]:
            listS1[i] = ''
            listS2[i] = ''
            x = x + 1
    #print(x, "matches found")

    S1 = ''.join(listS1)
    S2 = ''.join(listS2)

    # Now right align them by reversing strings and then finding matches

    #print("after removing matches, S1 and S2:", S1, S2)
    #print("\nLet's right align them")

    # Append spaces to front of shorter list to align them right
    reversed1 =''.join(reversed(S1))                # .join() method merges all of the characters resulting
    reversed2 =''.join(reversed(S2))                # from the reversed iteration into a new string

    #print("S1 and S2:", reversed1, reversed2)


    iterations = find_shorterLength(reversed1, reversed2)

    listS1 = []
    listS2 = []
    for s in str(reversed1):
        listS1.append(s)
    for s in str(reversed2):
        listS2.append(s)

    x = 0
    for i in range(0, iterations):
        if listS1[i] == listS2[i]:
            listS1[i] = ''
            listS2[i] = ''
            x = x + 1
    #print("After right aligning", x, "matches found")


    #reverse them back to origial strings

    S1 = ''.join(reversed(listS1))
    S2 = ''.join(reversed(listS2))


    # OUTPUT: For each input,print the shorter of the two resulting strings or the first in alphabetical
    # order if they have the same length.

    if len(S1) == len(S2):
        string = min(S1, S2)

    elif len(S1) < len(S2):
        string = S1
    else:
        string = S2

    #print("S1 is", S1, ", S2 is:", S2, ", and output is:", string)

    #finally print the result in output file
    writeoutput(string)