Pure Programmer
Blue Matrix


Cluster Map

Project: Palindrome Search

A [[palindrome]] is a word or phrase that is spelled the same when it is reversed. Write a program that searches a dictionary of English words to find ones that are palindromes and at least four characters in length. Pass the name of the dictionary file to search (one word per line) on the command line.

See Webster's Second International for a file that contains US English words (235k words from 1934 edition) or the open source file [[English Words]] on GitHub (466k words).

Output
$ python PalindromeSearch.py ../../data/text/EnglishWords.txt AAAA AAAAAA Ababa Abba acca Adda addda Adinida Aeaea Aenea ... tipit tirrit toot torot TSST tut-tut ululu Uttu waw-waw wow-wow

Solution