# -----------------------------------------------------------------------------
# Name:        translate
# Purpose:     assignment # 3
#
# Author: Raymond Cabrera
# Date: 01/26/2016
# -----------------------------------------------------------------------------
"""
Enter your docstring with a one-line overview here

and a more detailed description here.
"""



def starts_with_vowel(word):
    # return True if the word starts with a vowel and False otherwise
    VOWEL_LIST = ['a', 'e', 'i', 'o', 'u']
    if word[0] in VOWEL_LIST:
        return True
    else:
        return False

def encode(word):
    # translate a single word to the secret language
    # call starts_with_vowel to decide which pattern to follow
    # return a single word (translated)
    #print(word)
    if starts_with_vowel(word) == True:
        word.extend(['w', 'a', 'y'])
    else:
        word.extend([word.pop(0), 'a', 'r'])
    return word

def translate(text):
    # translate the whole text to the secret language:
    # split the text into a list of words
    # call encode to translate each of the words in the list and build a
    # new list with these translated words
    # join the list of translated words into a single string
    # and return it
    output_list = encode(list(text))
    #print(output_list)
    output_string = "".join(output_list)
    return output_string


def get_input():
    # prompt the user for input until they enter a non-empty string
    # return the string entered by the user
    input_string = input("Please enter a message :")
    if input_string == "":
        get_input()
    return input_string

def main():
    # get input and save it in a variable
    # translate the saved input by calling translate - save result
    # print the result
    input_string = get_input()
    output_string = translate(input_string)
    return print(output_string)


if __name__ == '__main__':
    main()
