S = str(input()) N = len(S) stack = [] ans = 1 for i in range(N): if not stack: stack.append(S[i]) ans += 1 else: if stack[-1] == S[i]: stack.pop() else: stack.append(S[i]) ans += 1 print(ans)