Write a function countCharacters(sentence) that counts how many times every character occurs in a sentence.
sentence is a string. It can be empty.'A' and 'a' are the same character. Put letters into the Map in lower case. This is a case insensitive count.'\t') and new lines ('\n').Map.countCharacters('Hi hi')Returns Map(2) { 'h' => 2, 'i' => 2 }
countCharacters('Aa, 1!')Returns Map(4) { 'a' => 2, ',' => 1, '1' => 1, '!' => 1 }
countCharacters(' ')Returns Map(0) {}
Asked at Arcesium · Source
countCharacters('Hello World')Map(7) {
'h' => 1,
'e' => 1,
'l' => 3,
'o' => 2,
'w' => 1,
'r' => 1,
'd' => 1
}countCharacters('a.b.a')Map(3) { 'a' => 2, '.' => 2, 'b' => 1 }Hidden tests run on Submit.