
def func(S,before,index,result):
    result = 0
    index = 0
    for i in range(len(S)):
        if S[index] != before:
            before = S[index]
            index += 1
        else:
            before = ""
            index += 2
        result += 1
        if index >= len(S):
            return result
def main():
    S = input()
    result = func(S,"",0,0)
    result2 = func(S,S[:2],2,1)
    print(max([result,result2]))
if __name__ == '__main__':
    main()
