import collections text = input("Input a text: ") word = input("Input a word: ") word_count = collections.Counter(text.split(" ")) print(word_count) print(f"{word}は{word_count.get(word,0)}回登場します")
Standard input is empty
Input a text:
Traceback (most recent call last): File "./prog.py", line 3, in <module> EOFError: EOF when reading a line