Driver Code
public static void Main ( String [ ] args ) { String s = " abacsddaa " ; int pos ; int n = s . Length ; int [ ] query = { 9 , 3 , 2 } ; int Q = query . Length ; for ( int i = 0 ; i < Q ; i ++ ) { pos = query [ i ] ; Console . WriteLine ( Count ( s , pos ) ) ; } } }