S=input()
ans=len(S)
def solve(s):
    res=""
    cnt=0
    while cnt < len(s):
        if cnt == len(s)-1:
            res+=s[cnt]
            cnt+=1
        elif s[cnt] ==s[cnt+1]:
            res +=s[cnt]
            cnt+=1
        else:
            cnt+=2

    if len(s) == len(res):
        return ans-len(s)
    else:
        return solve(res)

print(solve(S))