memo = {}
def solve(S):
    if len(S)<1:
        return 0
    crs = 0
    if S in memo:
        return memo[S]
    while crs + 1 < len(S):
        if S[crs] != S[crs+1]:
            memo[S] = solve(S[:crs]+S[crs+2:])+2
            return memo[S]
        crs += 1
    return 0
S = input()
print(solve(S))