Hash map to store the occurrence of frequencies of characters
Dictionary < int , int > hash = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < 26 ; i ++ ) if ( arr [ i ] != 0 ) { if ( hash . ContainsKey ( arr [ i ] ) ) { hash [ arr [ i ] ] = hash [ arr [ i ] ] + 1 ; } else { hash . Add ( arr [ i ] , 1 ) ; } }