def locnt(s):
    index = 0
    lopair = 0
    while(index <= len(s)-2):
        if (s[index] != s[index+1]):
            lopair += 1
            index += 2
        else :
            index += 1
    return lopair

ans = 0
s = input()
lopair = locnt(s)
while(lopair):
    s = list(s)
    n = lopair
    i = 0
    while(n):
        if s[i] != s[i+1]:
            n -= 1
            ans += 2
            s[i] = '9'
            s[i+1] = '9'
            i += 2
        else:
            i += 1
    s = "".join(s).replace('9', "")
    lopair = locnt(s)
print(ans)