strcount(S)
単語をキーとして辞書を返し、単語が対応する値として出現する回数を返す関数を作成するのに助けが必要です。出力は次のようになります。
strcount("a a a a b b")
{'a': 4, 'b': 2}
strcount("one")
{'one': 1}
sorted(strcount("this one and that one for one time").items())
[('and', 1), ('for', 1), ('one', 3), ('that', 1), ('this', 1), ('time', 1)]