fun main(args: Array<String>) {
    val S = readLine()!!
    var n = S.length
    var ans = S.length
    var prev = S[0]
    for ((k, c) in S.withIndex()) {
        if (c != prev) {
            var t = arrayOf(k, n - k).max()!!
            ans = arrayOf(ans, t).min()!!
        }
        prev = c
    }
    println(ans)
}
