Function to count frequency of each char in the string . freq [ 0 ] for ' a ' , ... . , freq [ 25 ] for ' z '
function countFreq ( $ str , & $ freq , $ len ) { for ( $ i = 0 ; $ i < $ len ; $ i ++ ) $ freq [ ord ( $ str [ $ i ] ) - ord ( ' a ' ) ] ++ ; }