sq = list(input()) for i in range(len(sq)): if sq[i] == '(': s = 1 psq = sq[i+1:] for j in range(len(psq)): if psq[j] == '(': s += 1 else: s -= 1 if s == 0: break print(i+j+2) else: s = 1 psq = sq[:i] for j in range(len(psq)): if psq[-(j+1)] == ')': s += 1 else: s -= 1 if s == 0: break print(i-j)