Driver Code
int main ( ) { string s = " abacsddaa " ; int pos ; int n = s . length ( ) ; int query [ ] = { 9 , 3 , 2 } ; int Q = sizeof ( query ) / sizeof ( query [ 0 ] ) ; for ( int i = 0 ; i < Q ; i ++ ) { pos = query [ i ] ; cout << Count ( s , pos ) << endl ; } return 0 ; }