Count the frequency in the string
for ( int i = 0 ; i < n ; ++ i ) freq [ s [ i ] - ' a ' ] ++ ; multiset < int > se ; HashSet < int > se = new HashSet < int > ( ) ; for ( int i = 0 ; i < 26 ; ++ i ) if ( freq [ i ] > 0 )