def solution(p): def divide_p(p) : count_l = 0 count_r = 0 for i in range(len(p)) : if p[i] == '(' : count_l += 1 else : count_r += 1 if count_l == count_r : break return p[:i+1], p[i+1:] def right(u) : result = True count = 0 for i in u : if i == '(' : count += 1 else : count -= 1 if count < 0 : result = False break return result if p == '' : return '' u, v = divide_p(p) if right(u) == True : r..