from collections import defaultdict

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

s = readChar()
s2 = s
b="-1"
ans=0
l=[]
while len(s)>1:
  if b!=s[:1]:
    b=s[:1]
    s=s[1:]
    ans+=1
  else:
    b=s[:2]
    s=s[2:]
    ans+=1
  l.append(b)
l.append(s)

for i in range(len(l)-1,-1,-1):
  if l[i]==l[i-1]:
    l[i-1]+=l[i]
    del l[i]

ans1 = len(l)
s = s2
b=s[:2]
ans=0
l=[s[:2]]
s=s[2:]
while len(s)>1:
  if b!=s[:1]:
    b=s[:1]
    s=s[1:]
    ans+=1
  else:
    b=s[:2]
    s=s[2:]
    ans+=1
  l.append(b)
l.append(s)

#print(l)

for i in range(len(l)-1,-1,-1):
  if l[i]==l[i-1]:
    l[i-1]+=l[i]
    del l[i]

if "" in l:
  l.remove("")

ans2 = len(l)

print(max(ans1,ans2))

#print(len(l))