fun main(args: Array<String>) {
    val S = next()
    val N = S.length
    var ans = N
    for (n in 0 .. N - 2) {
        if (S[n] != S[n + 1]) {
            ans = Math.min(Math.max(n + 1, N - n - 1), ans)
        }
    }
    println(ans)
}

fun next() = readLine()!!
