Function to find the number of occurrences of a character at position P upto p - 1
function countOccurrence ( s , position ) { let alpha = new Array ( 26 ) ; for ( let i = 0 ; i < 26 ; i ++ ) { alpha [ i ] = 0 ; } let b = new Array ( s . length ) ;