# This opens file "words25k.txt" and prints the
# palindromes from that file.

def reverse(s):
    # This returns the reversal of string s
    if len(s) <= 1:
        return s
    else:
        return  reverse( s[1:] ) + s[0]

def isPalindrome(s):
    # this returns True if s is a palindrome
    if s == reverse(s):
        return True
    else:
        return False
    
def main():
    F = open( "words25K.txt", "r" )
##    for line  in F:
##        word = line.strip()
##        if isPalindrome(word.lower()):
##            print( word )
    longest = ""
    for line in F:
        word = line.strip()
        if len(word) > len(longest):
            longest = word
    print( "The longest word was %s" % longest)

main()
