Function to find the number of occurrences of a character at position P upto p - 1
int Occurrence ( string s , int position ) { int count = 0 ; for ( int i = 0 ; i < position - 1 ; i ++ ) if ( s [ i ] == s [ position - 1 ] ) count ++ ;