S=input()+'9'

tmp=[]
cnt=0
while 2<=len(set(S)):
    # print(S)
    i=0
    while i < len(S)-1:
        if S[i+1]=='9': # 番兵法
            tmp.append(S[i])
            break
        if S[i] == S[i+1]:
            tmp.append(S[i])
            i+=1
        else:
            cnt+=2
            i+=2
            
    S=''.join(tmp)
    tmp=[]
print(cnt)