count number of duplicate characters in a string java using map