fork download
  1. import collections
  2.  
  3. text = input("Input a text: ")
  4. word = input("Input a word: ")
  5.  
  6. word_count = collections.Counter(text.split(" "))
  7. print(word_count)
  8. print(f"{word}は{word_count.get(word,0)}回登場します")
  9.  
Runtime error #stdin #stdout #stderr 0.16s 23492KB
stdin
Standard input is empty
stdout
Input a text: 
stderr
Traceback (most recent call last):
  File "./prog.py", line 3, in <module>
EOFError: EOF when reading a line