Function to return the frequency of the given character in the sub - string str [ l ... r ]
function getFrequency ( ch , l , r ) { if ( l == 0 ) return freq [ ch . charCodeAt ( ) ] [ r ] ; else return ( freq [ ch . charCodeAt ( ) ] [ r ] - freq [ ch . charCodeAt ( ) ] [ l - 1 ] ) ; }