def solve(S):
    ans = 0
    for i, j in [(0, 1), (0, 2)]:
        previous_word = ""
        tans = 0
        while j < len(S) and i < len(S):
            if S[i:j] != previous_word:
                previous_word = S[i:j]
                tans += 1
                i = j
                j = i + 1
            else:
                j += 1
        if S[i:j] and S[i:j] == previous_word:
            # invalid
            continue
        else:
            if S[i:j]:
                tans += 1
            ans = max(ans, tans)
    return ans

if __name__ == "__main__":
    S = input()
    print(solve(S))
