import java.lang.Math.*

private fun readln() = readLine()!!.trim()
private fun readlnInt() = readln().toInt()
private fun readlnStrings() = readln().split(' ')
private fun readlnInts() = readlnStrings().map { it.toInt() }
private fun readlnLongs() = readlnStrings().map { it.toLong() }


fun solve() {
    val s = readln()
    if (s.length<=1){
        print(1)
        return
    }
    val N = s.length
    val dp1 = IntArray(N+1){0}
    val dp2 = IntArray(N+1){0}
    dp1[0] = 1
    dp2[1] = 1
    if (s[0]!=s[1]){
        dp1[1] = 2
    } else {
        dp1[1] = 1
    }
    for (i in 2 until N){
        if (s[i] != s[i-1]){
            dp1[i] = max(dp1[i], dp1[i-1])
        }
        dp1[i] = max(dp1[i], dp2[i-1])
        dp1[i] += 1
        if (i>3){
            if (s.substring(i-3..i-2) != s.substring(i-1..i)){
                dp2[i] = max(dp2[i], dp2[i-2])
            }
        } else {
            dp2[i] = max(dp2[i], dp2[i-2])
        }
        dp2[i] = max(dp2[i], dp1[i-2])
        dp2[i] += 1
    }
//    println(dp1.toList())
//    println(dp2.toList())
    println(max(dp1[N-1], dp2[N-1]))
}


fun main(args: Array<String>) {
//    val queryNum = readlnInt()
//    for (queryIdx in 1..queryNum) {
//        println("Case #$queryIdx:")
        solve()
//    }
}
