Driver code
s = " abaaab " NEW_LINE dp = [ [ 0 for i in range ( N ) ] for i in range ( N ) ] NEW_LINE pre_process ( dp , s ) NEW_LINE queries = [ [ 0 , 1 ] , [ 1 , 5 ] ] NEW_LINE q = len ( queries ) NEW_LINE for i in range ( q ) : NEW_LINE INDENT answerQuery ( queries [ i ] [ 0 ] , queries [ i ] [ 1 ] , dp ) NEW_LINE DEDENT