Function to calculate the maximum length of substring of the form R ^ nK ^ n
def find ( s ) : NEW_LINE INDENT Max = j = countk = countr = 0 NEW_LINE table = [ [ 0 , 0 ] for i in range ( len ( s ) ) ] NEW_LINE DEDENT