calculate frequency of characters
for ( int i = 0 ; i < str1 . Length ; i ++ ) { count1 [ str1 [ i ] - ' a ' ] ++ ; } for ( int i = 0 ; i < str2 . Length ; i ++ ) { count2 [ str2 [ i ] - ' a ' ] ++ ; }