def dblcnt(s):
    count = 0
    for i in range(len(s)-1):
        if(s[i] == s[i+1]):
            count += 1
    return count

ans = 0
s = list(input())
a = s.copy()
n = dblcnt(s)
while(n):
    s = list(s)
    i = 0
    while(n):
        if (s[i] == s[i+1]):
            a.pop(i)
            a.insert(i, '9')
            a.pop(i+1)
            a.insert(i+1, '9')
            n -= 1
        i += 1
    ans += a.count('9')
    s = "".join(a)
    s = s.replace('9',"")
    n = dblcnt(s)
print(ans)
