~cpp f = file("Alice.txt", 'r') def cut(word): for mark in ''',.'():;~=-?!`''': word = word.replace(mark,"") return word result = {} for word in f.read().split(): word = cut(word) if word in result.keys(): result[word] +=1 else: result[word] = 1 report = list() for word, count in result.items(): report.append((word, count)) report.sort() def asciiSum(word): return 0 for each in report: print each[0], each[1], asciiSum(each[0]) f.close()