Reduce the frequency of the current character and count by 1 , so that it cannot interfere with the calculations of the same elements present to the right of it .
m . put ( str . charAt ( i ) , m . get ( str . charAt ( i ) ) - 1 ) ; count -- ; }