To store the
Dictionary < char , int > occ = new Dictionary < char , int > ( ) ; for ( int i = 0 ; i < len ; i ++ ) if ( occ . ContainsKey ( arr [ i ] ) ) { occ [ arr [ i ] ] = occ [ arr [ i ] ] + 1 ; } else { occ . Add ( arr [ i ] , 1 ) ; }