fbpx

#kotlinDevChallenge – 6

Write a function that takes a string and returns a map where each key is a character and its value is the number of its occurrences in the given string. For example, for the string “kotlin”, the function should return the map: {k=1, o=1, t=1, l=1, i=1, n=1}. Complete the code of the countCharacters function.