fixed the input error in frequent_words and add doctest