S = input()
S = list(S)
count = 0


for j in range(200) :
    if len(S) < 2:
        break
    
    if S[0] != S[1] :
        S.pop(0)
        S.pop(0)
        count+=2
    
    
    for i in range(1,len(S)-2) :
        print(S, i)
        if S[i] != S[i+1] :
            if S[i-1] != S[i+2] :
                S.pop(i)
                S.pop(i)
                count +=2
                break
            
print(count)
        
