# coding: utf-8
# Your code here!
S=list(input())[::-1]

count=0
temp=[]
pre=[]
while len(S)>3:
    temp.append(S.pop(-1))
    if temp==pre:
        temp.append(S.pop(-1))
    pre.clear()
    pre+=temp
    temp.clear()
    count+=1

if len(S)==3:
    if pre[-1]==S[2] or S[2]==S[1] or S[1]==S[0]:
        print(count+2)
    else:
        print(count+3)
else:
    if pre[-1]==S[1] or S[1]==S[0]:
        print(S[10])
        print(count+1)
    else:
        print(count+2)
