X = input()
Y = X[::-1]
if X[-1]==X[-2]:
  A = 0
else:
  A = 1  
x = X[0:1]
X = X[1:]
for i in range(200000):
  if len(X) > 0:
    if x != X[0:1]:
      x = X[0:1]
      X = X[1:]
      A += 1
    else : 
      x = X[0:2]
      X = X[2:]
      A += 1
  else:
    break
    

if Y[-1]==Y[-2]:
  B = 0
else:
  B = 1  
x = Y[0:1]
Y = Y[1:]
for i in range(200000):
  if len(X) > 0:
    if x != Y[0:1]:
      x = Y[0:1]
      Y = Y[1:]
      B += 1
    else : 
      x = Y[0:2]
      Y = Y[2:]
      B += 1
  else:
    break
print(min(A,B))

