I am trying to replace following code:
for(char c: s.toCharArray()) charMap.put(c,charMap.getOrDefault(c,0)+1);
with this: