import os,re,sys,operator,math
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy
import heapq
import numpy as np

setrecursionlimit(10**6)
s=stdin.readline().rstrip()
lens=len(s)
loop1=1
loop2=lens-2
t2=list(s[-1])
t1=list(s[0])
now=0
z=""
while loop1<lens:
    z=str(s[loop1])
    ch=False
    while loop1<lens:
        if z!=t1[now]:
            t1.append(z)
            ch=True
            now+=1
            break
        else:
            loop1+=1
            if loop1<lens:
                z+=s[loop1]
    if not ch:
        t1[-1]+=z
    loop1+=1
z=""
now=0
while loop2>-1:
    z=str(s[loop2])
    ch=False
    while loop2>-1:
        if z!=t2[now]:
            t2.append(z)
            ch=True
            now+=1
            break
        else:
            loop2-=1
            if loop2>-1:
                z+=s[loop2]
    if not ch:
        t2[-1]+=z
    loop2-=1
print(max(len(t1),len(t2)))