Driver Code
if __name__ == " _ _ main _ _ " : NEW_LINE INDENT s = " ABCABCABABC " NEW_LINE K = " ABC " NEW_LINE precompute ( s , K ) NEW_LINE Q = [ [ 1 , 6 ] , [ 5 , 11 ] ] NEW_LINE for it in Q : NEW_LINE INDENT print ( cnt [ it [ 1 ] - 1 ] - cnt [ it [ 0 ] - 1 ] ) NEW_LINE DEDENT DEDENT