Function to return the frequency array for the given string
static int [ ] getFrequencies ( String str ) { int [ ] freq = new int [ 26 ] ; for ( int i = 0 ; i < str . Length ; i ++ ) { freq [ str [ i ] - ' a ' ] ++ ; } return freq ; }