S = input()
num_len = len(S)
count=0
# for i in range(1,num_len):
#     if S[t]==S[i]:
#         t = t+1
#     elif S[t]!=S[i]:
#         count = count+1
#         t = t-1

print(num_len)
i=1
t=0
test=2
while test ==2:
    #print(i,t,count)
    if S[t]==S[i]:
        t+=1
        i+=1
    elif S[t]!=S[i]:
        count+=1
        i+=1
        t-=1
        if S[t]==S[i]:
            t=i
            i+=1
        elif S[i]!=S[t]:
            count+=1
            t-=1
    if i==num_len and t==-1:
        if S[t-1]==S[i]:
            break
        else:
            count+=1
            break
        
    elif i==num_len:
        if S[t-1]==S[i-1]:
            break
        else:
            count+=1
            i=i-1
print(count)
