def determine_winner(H): stack = [] total = 0 for c in H: if c == '(': stack.append(0) else: if not stack: continue # 根据问题描述,输入是合法的,所以这里不会触发 current = stack.pop() gr = current + 1 if stack: stack[-1] ^= gr else: total ^= gr return 0 if total != 0 else 1 # 读取输入 H = input().strip() print(determine_winner(H))