s  = input()
cnt = 0
p = ""
for i in s:
  if p != i:
    p = i
    cnt += 1
  else:
    p += i

bcnt = 0
bp = s[0]
for j in s:
  if bp != j:
    bp = j
    bcnt += 1
  else:
    bp += i
#print(cnt, bcnt)
print(max(cnt,bcnt))