Driver code
$ s = " abaaab " ; $ dp = array ( array ( ) ) ; $ dp = pre_process ( $ dp , $ s ) ; $ queries = array ( array ( 0 , 1 ) , array ( 1 , 5 ) ) ; $ q = count ( $ queries ) ; for ( $ i = 0 ; $ i < $ q ; $ i ++ ) answerQuery ( $ queries [ $ i ] [ 0 ] , $ queries [ $ i ] [ 1 ] , $ dp ) ; ? >