Skip to content

Instantly share code, notes, and snippets.

@AndroidPoet
Last active May 1, 2022 14:35
Show Gist options
  • Save AndroidPoet/eee5b0f8e7f2d4408025e457f9b94c56 to your computer and use it in GitHub Desktop.
Save AndroidPoet/eee5b0f8e7f2d4408025e457f9b94c56 to your computer and use it in GitHub Desktop.
eachCount
val words = "H,e,l,l,o w,o,r,l,d,H,e,l,l,o w,o,r,l,d".split(',')
val frequenciesofChars = words.groupingBy { it }.eachCount()
println("Counting frequencies letters:")
println(frequenciesofChars)
//Counting frequencies letters::
//{H=2, e=2, l=6, o w=2, o=2, r=2, d=2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment