Frequency word book

Report a typo

You need to do a task related to natural language processing: count the occurrence of words in a text. You need to read a line of words and print a map where the key represents a word and the value represents its occurrences. The keys should come in the order they occur in the original line. Below, you can find an example of the output.

Sample Input 1:

little brown fox brown fog

Sample Output 1:

little 1
brown 2
fox 1
fog 1
Write a program in Kotlin
fun main() {
var list = readln().split(" ")
// write your code

}
___

Create a free account to access the full topic