function to store frequency of each character in each string
public static void frequency ( int [ , ] fre , string [ ] s , int n ) { for ( int i = 0 ; i < n ; i ++ ) { string str = s [ i ] ; for ( int j = 0 ; j < str . Length ; j ++ ) { fre [ i , str [ j ] - ' a ' ] ++ ; } } }