S = input()
W = list(S)                
for i in range(len(W) - 2):        
    if W[i] == W[i+1]:
        for j in range(2, len(W)-2-i):
            W[i+1] += W[i+j]
            del W[i+j]
            if W[i] != W[i+1]:
                break
        k = len(W)
    if i > k - 3:
        break
if W[len(W)-2] == W[len(W)-1]:
    W[len(W)-2] += W[len(W)-1]
    del W[len(W)-1]                
print(len(W))