20200812, "I before E except after C" is a low-value heuristic . PATH_DICT = '/usr/share/dict/words' def main(): lst_tracks = [] lst_breaks = [] with open(PATH_DICT) as f_ptr: lines = [l.strip() for l in f_ptr.readlines() if len(l) > 0] for word in lines: # Stick to lower-case words if ord(word[0]) > 122 or ord(word[0]) < 97: continue if 'cei' in word: lst_tracks.append(word) elif 'ei' in word: lst_breaks.append(word) elif 'cie' in word: lst_breaks.append(word) elif 'ie' in word: lst_tracks.append(word) else: pass print('Tracks: %s'%(len(lst_tracks))) print('Breaks: %s'%(len(lst_breaks))) if __name__ == '__main__': main()