def solve(start, s):
    for i in range(start, len(s) - 1):
        if s[i] != s[i + 1]:
            return 1 + solve(i - 1, s[:i] + s[i + 2:])
    return 0


def main():
    S = input()
    # a, b, k = [int(a) for a in input().split()]

    print(solve(0, S) * 2)


if __name__ == '__main__':
    main()
