import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val ss = next().toList()
    val answer = mutableListOf<String>()

    var tmp = ""
    for (s in ss) {
        val str = tmp + s.toString()

        if (answer.size == 0) {
            answer.add(str)
            continue
        }

        if (answer.last() != str) {
            answer.add(str)
            tmp = ""
            continue
        }

        tmp += str
    }

    if (tmp == "") {
        println(answer.size)
    } else  {
        answer[answer.size-1] = answer.last() + tmp
        if (answer.last() == answer[answer.size-2]) {
            println(answer.size-1)
        } else {
            println(answer.size)
        }
    }
}

fun next() = readLine()!!

fun println(value : Any) {
    pw.println(value)
}