fun main(args: Array<String>) {
    agc037a()
}

fun agc037a() {
    val s = readLine()!!

    // dp[i文字目まで使用][次の文字を使う？(0/1)] = 答えの最大値
    val dp = Array(s.length) { LongArray(2) { 0 } }
    dp[0][0] = 1
    dp[0][1] = 1

    var beforeStr = "*"
    for (i in 1..s.lastIndex) {
        val currStr = if (i in 0 until s.lastIndex) s[i].toString() + s[i + 1].toString() else ":"
        dp[i][0] = 1 + if (s[i] == s[i - 1]) dp[i - 1][1] else Math.max(dp[i - 1][0], dp[i - 1][1])
        dp[i][1] = if (i + 1 <= s.lastIndex && i - 2 >= 0 && currStr == beforeStr) {
            1 + dp[i - 1][0]
        } else {
            Math.max(dp[i - 1][0], dp[i - 1][1])
        }
        beforeStr = currStr
    }

    val answer = dp.last().max()

    println(answer)
}
