Word Count With Map

Geoffrey Challen // 2021.9.0

Given a non-null String containing words separated by the "_" character, write a method wordCount that return a Map<String, Integer> containing the number of times that each part appears in the String.

So, for example, given the String "Xyz_Chuchu_Chuchu_Xyz_Ferdie", you would return a map with three mappings: "Xyz" to 2, "Chuchu" to 2, and "Ferdie" to 1.