def solve(S):
    lst = [S[0]]
    tmp = ''
    for s in S[1:]:
        tmp += s
        if lst[-1] == tmp:
            continue
        else:
            lst.append(tmp)
            tmp = ''
    # print(lst, tmp)
    if tmp:
        while 1:
            tmp += lst.pop()
            if not lst or lst[-1] != tmp:
                lst.append(tmp)
                break
    return len(lst)


_S = input()
print(min(solve(_S), solve(_S[::-1])))