S = input()
N = len(S)
dp = [0 for i in range(N)]
last = ['' for i in range(N)]
last[0] = S[0]
for i in range(1, N):
    if last[i-1][-1] != S[i]:
        dp[i] = dp[i-1] + 1
        if i >= 2:
            last[i] = last[i-2]
    else:
        dp[i] = dp[i-1]
        last[i] = last[i-1] + S[i]
print(dp[N-1]*2)