15 lines
290 B
Python
15 lines
290 B
Python
import re
|
|
|
|
text = input()
|
|
words = re.findall(r"[^\W_]+(?:'[^\W_]+)?", text.lower(), re.UNICODE)
|
|
counts = {}
|
|
|
|
for word in words:
|
|
if word in counts:
|
|
counts[word] += 1
|
|
else:
|
|
counts[word] = 1
|
|
|
|
for word, count in sorted(counts.items()):
|
|
print(f"{word}: {count}")
|
|
|