from fractions import gcd
import math

mod = 998244353

def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    s = input()
    n = len(s)

    dp = [[0] * 2 for i in range(n+2)]
    dp[1][0] = 1
    dp[2][1] = 1
    for i in range(n-1):
        if s[i] != s[i+1]:
            dp[i+1][0] = max(dp[i][0] + 1, dp[i+1][1])
        dp[i+2][1] = max(dp[i][0] + 1, dp[i+2][1])
        dp[i+1][0] = max(dp[i][1] + 1, dp[i+1][0])
        if i > 1 and s[i-1:i+1] != s[i+1:i+3]:
            dp[i+1][1] = max(dp[i][1] + 1, dp[i+1][1])

    print(max(dp[n-1]))

main()
