s = input() t = "" u = True for i in s: if i == "(": u = False if u: t += i if i == ")": u = True print(t)