'''
Pranav Velleleth
Grade 8
'''
def isVowel(char):
    all_vowels = 'AEIOU'
    return char in all_vowels

def removeDups(string):
    result = string[0]    
    for i in range(1, len(string)):
        if ( (isVowel(string[i])) or (string[i] != string[i-1]) ):
            result += string[i]
    return result

def removeVowels(string):
    result = string[0]

    for i in range(1,len(string)):
        if ( isVowel(string[i]) == False):
            result += string[i]
    return result

def deleteLikeCharAtLikePos(str0, str1, str2):
    if ( str0 == "RL" ):
            str1=''.join(reversed(str1)) 
            str2=''.join(reversed(str2)) 

    str1out=""
    str2out=""
    delList=[]
    i=0
    while ( i < min( len(str1) , len(str2))):
        if (str1[i] == str2[i]):  
            delList.append(i) 
        i = i+ 1

    for i in range(0, len(str1)):
        if (i not in delList):
            str1out = str1out + str1[i] 

    for i in range(0, len(str2)):
        if (i not in delList):
            str2out = str2out + str2[i]   
    
    if ( str0 == "RL" ):
        str1out=''.join(reversed(str1out)) 
        str2out=''.join(reversed(str2out)) 
                            
    return str1out, str2out

f=open('input.txt', 'r')
out = []
for line in f:
    out.append(line.strip().split(" "))
f.close()

 
for k in range(5):
    str1, str2 = deleteLikeCharAtLikePos ( "LR" , removeVowels(removeDups(out[k][0])), removeVowels(removeDups(out[k][1])))
    str1, str2 = deleteLikeCharAtLikePos ( "RL" , str1, str2)
    # print ( str1, "-" , str2)
    
    strings = []
    if len(str1)>len(str2):
        print(str(k+1)+ ". " +   str2)
    elif len(str2)>len(str1):
        print(str(k+1)+ ". " +  str1)
    else:
        strings = sorted([str1, str2])
        strings = []
        strings.append(str1)
        strings.append(str2)
        strings = sorted(strings)
        print(str(k+1)+ ". " +  strings[0])