s = str(input())
cnt = 0
while len(s) > 1:
    for i in range(len(s) - 1):
        if s[i] != s[i + 1]:
            cnt += 2
            if i == len(s) - 1:
                break
            else:
                s = s[:i] + s[i + 2:]
                break
    else:
        break
print(cnt)
