import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next()
    val n = s.length
    val dp = Array(n + 1) { Array(3) {-1} }
    dp[1][1] = 1
    if (n >= 2) {
        dp[2][2] = 1
    }
    for (i in 1 until n) {
        for (j in 1..2) {
            if (dp[i][j] == -1) {
                continue
            }
            val pre = s.substring(i - j, i)
            val next = s.substring(i, i + 1)
            if (pre != next) {
                dp[i + 1][1] = Math.max(dp[i + 1][1], dp[i][j] + 1)
            }

            if (i + 2 > n) {
                continue
            }
            val next2 = s.substring(i, i + 2)
            if (pre != next2) {
                dp[i + 2][2] = Math.max(dp[i + 2][2], dp[i][j] + 1)
            }
        }
    }
    println(Math.max(dp[n][1], dp[n][2]))
}