fork download
  1. def f(s): return {w: s.split().count(w) for w in set(s.split())}
  2. print(f("yes yes ok ok "))
Success #stdin #stdout 0.01s 7324KB
stdin
Standard input is empty
stdout
{'yes': 2, 'ok': 2}