def f(s, n, c):
    rem = s[0]
    for i in range(n):
        if s[i] != rem:
            c += 2
            s = s[:i-1] + s[i + 1:]
            return f(s, n - 2, c)
        rem = s[i]
    return c


if __name__ == '__main__':
    S = input()
    N = len(S)
    c = 0
    print(f(S,N,c))
