# Arup Guha
# 7/17/2013
# Solution to SI@UCF Program: String Class Practice
# Note: This solves both parts at the same time and outputs both solutions.

def main():

    # Get first word.
    n = int(input("How many words are you going to enter?\n"))
    firstWord = input("Enter the words.\n")
    maxEWord = firstWord
    mostEs = numEs(maxEWord)
    
    # Read in rest.
    for i in range(n-1):

        # Get next word.
        curWord = input("")

        # Update first alphabetical.
        if curWord.lower() < firstWord.lower():
            firstWord = curWord

        # Update Most E word, if necessary.
        if numEs(curWord) > mostEs:
            maxEWord = curWord
            mostEs = numEs(curWord)

    # Print output to both parts.
    print("The first word alphabetically is ", firstWord, ".", sep="")
    print("The word with the most Es is ", maxEWord, ".", sep="")

# Returns the number of e's in s.
def numEs(s):

    cnt = 0
    for i in range(len(s)):
        if s[i] == 'e' or s[i] == 'E':
            cnt = cnt + 1
    return cnt

main()
