Driver code
var s = " " ; var dp = Array ( N ) . fill ( ) . map ( ( ) => Array ( N ) . fill ( ) ) ; pre_process ( dp , s ) ; var queries = [ [ 0 , 1 ] , [ 1 , 5 ] ] ; var q = queries . length ; for ( i = 0 ; i < q ; i ++ ) { answerQuery ( queries [ i ] [ 0 ] , queries [ i ] [ 1 ] , dp ) ; }