Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order. Uppercase words should take precedence over lowercase words. For example, 'Z' comes before 'a'.
The input file can contain one or more sentences, or be a multiline list of words.
"the quick brown fox jumps over the lazy dog"
textFileName = input("Enter the input file name: ")
textFile = open(textFileName, 'r')
listOfWords = []
while True:
line = textFile.readline()
if line == "":
break
else:
words = line.split()
for word in words:
listOfWords.append(word)
listOfWords.sort()
uniqueListOfWords = []
for count in range(len(listOfWords) -1):
if listOfWords[count]!= listOfWords[count + 1]:
uniqueListOfWords.append(listOfWords[count])
uniqueListOfWords.append(listOfWords[len(listOfWords) -1])
print(word)