Count number of occurrence of a charterer in the string
let mp = new Map ( ) ; for ( let i = 0 ; i < n ; i ++ ) mp . set ( str [ i ] , mp . get ( str [ i ] ) == null ? 1 : mp . get ( str [ i ] ) + 1 ) ;