import sys
sys.setrecursionlimit(100000)
S = input()
def div(strings):
    if len(strings) == 0:
        return 0
    elif len(strings) == 1:
        return 1
    elif len(strings) == 2:
        if S[0] == S[1]:
            return 1
        else:
            return 2
    elif strings[len(strings)-1] != strings[len(strings)-2]:
        return div(strings[0:len(strings)-1]) + 1
    else:
        return div(strings[0:len(strings)-3]) + 2
print(div(S))