Driver code
int main ( ) { string s = " abaaab " ; bool dp [ N ] [ N ] ; pre_process ( dp , s ) ; int queries [ ] [ 2 ] = { { 0 , 1 } , { 1 , 5 } } ; int q = sizeof ( queries ) / sizeof ( queries [ 0 ] ) ; for ( int i = 0 ; i < q ; i ++ ) answerQuery ( queries [ i ] [ 0 ] , queries [ i ] [ 1 ] , dp ) ; return 0 ; }