/*
ACSL Contest 2, Word Transformation, By Vaibhav Janardhan
*/
import java.util.Scanner;

public class Word
{
      private String letters;
      Word(String me){
            letters = me;
        }
    void print(){
        System.out.println(letters);
    }

    // cons is consenents
    void
    delcons()
    {
        String
    newLetters = "";
    newLetters = newLetters + letters.charAt(0);
    for (int i = 1; i < letters.length(); i++){
    char x = letters.charAt(i);
    if ( x == letters.charAt(i-1)) {
    // System.out.println("Duplicate" + " " + i + " " + letters.charAt(i));
    }
    else
    {
    newLetters = newLetters + letters.charAt(i);
    }
    }
    letters = newLetters;
    }

    void delvow(){
    String newLetters = "";
    newLetters = newLetters + letters.charAt(0);
    for (int i = 1; i < letters.length(); i++) {
    char x = letters.charAt(i);
    if (x == 'A' || x == 'E' || x == 'I' || x == 'O' || x == 'U') {
    //System.out.println("Vowel " + x);

    }
    else
    {
    newLetters = newLetters + x;
    }
    }
    letters = newLetters;
    }

    void removeL(String otherWord){
    String newLetters = "";
    int length;
    if (otherWord.length() < letters.length()){
    length = otherWord.length();
    }
    else
    {
    length = letters.length();
    }
    int i;
    for (i = 0; i < length; i++){
    char x = letters.charAt(i);
    if ( x == otherWord.charAt(i)){
    // System.out.println ("Duplicate "+ x);
    }
    else
    {
    newLetters += x;
    }
    }


while (i < letters.length())
    {
    newLetters += letters.charAt(i);
    i++;
    }

    letters = newLetters;
}
void
removeR(String otherWord){
String newLetters = "";
int length;
if (otherWord.length() < letters.length()){
length = otherWord.length();
}
else
    {
        length = letters.length();
    }
    int
    i;
    for (i = 0; i < length; i++) {
        char x = letters.charAt(letters.length()-1-i);
    if (x == otherWord.charAt(otherWord.length()-1-i)) {
    // System.out.println("Duplicate "+ x);
    }
    else
    {
    newLetters = x + newLetters;
    }
    }

    while (i < letters.length()){
    newLetters = letters.charAt(letters.length()-1-i) + newLetters;
    i++;
    }
    letters = newLetters;
    }

    public static void main(String[] args) {
    Scanner scanner = new Scanner(System. in);
    String a = scanner.next();
    String b = scanner.next();
    Word
    first = new
    Word(a);
    Word
    second = new
    Word(b);
    first.delcons();
    first.delvow();
    second.delcons();
    second.delvow();

    String o = first.letters;
    first.removeL(second.letters);
    second.removeL(o);

    o = first.letters;
    first.removeR(second.letters);
    second.removeR(o);

    if (second.letters.length() == first.letters.length())
        {
        if (second.letters.charAt(0) < first.letters.charAt(0))
        {
            System.out.println(second.letters);
        }
        else
        {
            System.out.println(first.letters);
        }

        }
        else if (second.letters.length() < first.letters.length()) {
        System.out.println(second.letters);
        }
        else
            {
                System.out.println(first.letters);
            }
            }
            }