# Takes a string as parameter and extracts all the words in this string # into a list of words def extractWords(s): punctuations = [",", ".", "?", ";", ":", "!"] for ch in punctuations: s = s.replace(ch, " ") return s.split() # Converts the given string s into lower case and returns it def makeLower(s): return s.lower() # Takes a list L as a parameter and returns a new list obtained by deleting # all duplicates from L def removeDuplicates(L): uniqueL = [] for e in L: if e not in uniqueL: uniqueL = uniqueL + [e] return uniqueL # main program print "Enter some text: hit an extra enter when done." s = raw_input() L = [] while s: L = L + extractWords(s) s = raw_input() print sorted(removeDuplicates(map(makeLower, L)))