str=input("") t=0 for i in str: if i== "(" : t+=1 elif i== ")" : if t>0: t-=1 elif t<=0: print("配对不成功") break else: continue else: if t!= 0: print("配对不成功") else: print("配对成功")