# Takoma Park M.S.
# Jr-5
# Contest 2
# Sameer Mehta

# input file
FILE_NAME = "2jr_testdata.txt"

# open file
with open(FILE_NAME) as f:

    # for every line in the file
    for line in f:

        # strip and split the line into a list
        line = line.strip().split()

        # split the line into two words
        word1 = list(line[0])
        word2 = list(line[1])

        # delete the second occurance of any double constant in word1
        i = 0
        while i < len(word1)-1:
            if word1[i] == word1[i+1] and word1[i] not in ["A","E","I","O","U"]:
                word1.pop(i+1)
            i += 1

        # delete the second occurance of any double constant in word2
        i = 0
        while i < len(word2)-1:
            if word2[i] == word2[i+1] and word2[i] not in ["A","E","I","O","U"]:
                word2.pop(i+1)
            i += 1

        # delete all vowels in word1 unless it is the first letter in the word
        i = 1
        while i < len(word1):
            if word1[i] in ["A","E","I","O","U"]:
                word1.pop(i)
            else:
                i += 1

        # delete all vowels in word2 unless it is the first letter in the word
        i = 1
        while i < len(word2):
            if word2[i] in ["A","E","I","O","U"]:
                word2.pop(i)
            else:
                i += 1

        # delete all characters at like positions from left to right
        i = 0
        while i = 0 and j >= 0:
            if word1[i] == word2[j]:
                word1.pop(i)
                word2.pop(j)
            i -= 1
            j -= 1

        # print the shorter of the two strings or the first in alphabetical order if they have the same length
        if len(word1) > len(word2):
            print("".join(word2))
        elif len(word2) > len(word1):
            print("".join(word1))
        else:
            sortedWords = [word1,word2]
            sortedWords.sort()
            print("".join(sortedWords[0]))