import bisect, collections, copy, heapq, itertools, math, numpy, string
import sys
from bisect import bisect_left, bisect_right, insort
from collections import deque
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def MS(): return map(str, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
# N = I()
# A = [LI() for _ in range(N)]

s = S()
ans = [0]
ss = 1
n = len(s)
for i in range(1,n):
    if s[i] != s[i-1]:
        if ss % 2 != 0:
            ans.append(ss)
            ss = 1
        else:
            ss = ans[-1] + 1

    else:
        ss += 1
if ss % 2 == 0:
    print(n-len(ans)+1)
else:
    print(n-len(ans))
