S = str(input())
S= list(S)
switch = 0  
for i in range(len(S)):
    S[i] = int(S[i])
S_change = S
result = 0
count = 1
while len(S_change) >= 2 and count != 0:   
    S_list = S_change
    S_change = []
    count = 0
    switch = 0
    # print(S_list)
    for i in range(len(S_list)):
        if switch == 1:
            switch = 0
        elif i == len(S_list)-1:
            S_change.append(S_list[i])
        elif S_list[i] != S_list[i+1]:
            result = result +2
            count = count + 1
            switch = 1        
        else:
            S_change.append(S_list[i])
    # print(S_change)
print(result)