
S = input()
work=list(S)
i=0
cout=0
while(True):
    if(i==len(work)-1):
        break
    if(work[i]==work[i+1]):
        i+=1
    else:
        cout+=2
        del work[i]
        del work[i]
        i=0

    

print(len(S)-len(work))