def unification(n,s,count):
    if n < 1:
        return count

    for i in range(n-1):
        if s[i] !=  s[i+1]:
            s.pop(i)
            s.pop(i)
            return unification(n-2,s,count+2)

    return count

if __name__ == '__main__':
    s = raw_input()
    n = len(s)
    _s = [i for i in s]

    print unification(n,_s,0)