def divide(s):
    pre = s.pop(-1)
    cnt = 1
    f = 0
    while len(s) >= 2:
        now = s.pop(-1)
        if f == 1:
            f = 0
        elif now == pre:
            s.pop(-1)
            f = 1
        else:
            pass
        cnt += 1
        pre = now
    if len(s) == 1 and pre != s.pop(-1) or f == 1:
        cnt += 1
    return cnt


s = list(input())
sr = s[::-1]
print(max(divide(s), divide(sr)))