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


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

# splits strings into lists
def splitWords(word):
    return list(word)

# calls delconsonants
def doubleConsonantsRemove(S1, S2):
    L1 = splitWords(S1)
    L2 = splitWords(S2)
    n=1
    l = len(S1)
    delConsonants(L1, l, n)
    S1 = ''.join(map(str, L1))
    n = 1
    m = len(S2)
    delConsonants(L2, m, n)
    S2 = ''.join(map(str, L2))
    L3 = [S1, S2]
    return L3

# deletes double occurences of consonants
def delConsonants(L1, l, n):
    while n < l:
        if not isAVowel(L1[n]):
            if L1[n-1]==L1[n]:
                del L1[n]
                l = len(L1)
                n = n+1
            else:
                n = n+1
        else:
            n = n + 1

# checks if character is a vowel or not
def isAVowel(char):
  if char=='A' or char=='E' or char=='I' or char=='O' or char=='U' or char=='a' or char=='e' or char=='i' or char=='o' or char=='u':
      return True
  else:
    return False

# deletes vowels
def delVowels(L1, l, n):
    while n < l:
        if isAVowel(L1[n]):
            del L1[n]
            l = len(L1)
        else:
            n = n + 1

# calls delvowels
def removeVowelsExceptFirst(S1, S2):
    n = 1
    L1 = splitWords(S1)
    L2 = splitWords(S2)
    l = len(L1)
    delVowels(L1, l, n)
    S1 = ''.join(map(str, L1))
    n=1
    m = len(S2)
    delVowels(L2, m, n)
    S2 = ''.join(map(str, L2))
    L3 = [S1, S2]
    return L3

# left aligns string
def leftAlign(leng, shortString):
    return shortString + leng * ' '

# deletes matches after left aligned
def leftAlignedMatches(S1, S2):
    n = 0
    shortString = ''
    leng = 0
    if len(S1) > len(S2):
        leng = len(S1) - len(S2)
        shortString = S2
        longString = S1
    else:
        leng = len(S2) - len(S1)
        shortString = S1
        longString = S2
    leftAlignedString = leftAlign(leng, shortString)
    L1 = splitWords(longString)
    L2 = splitWords(leftAlignedString)
    m = len(leftAlignedString)
    while n len(S2):
        leng = len(S1) - len(S2)
        shortString = S2
        longString = S1
    else:
        leng = len(S2) - len(S1)
        shortString = S1
        longString = S2
    rightAlignedString = rightAlign(leng, shortString)
    L1 = splitWords(longString)
    L2 = splitWords(rightAlignedString)
    m = len(rightAlignedString)
    while nlen(S2):
        return S2
    elif len(S1)