import scala.io.StdIn._

object Main extends App {
  val s = readLine()

  var count = 1
  while (count < s.length && s(count) == s.head) {
    count += 1
  }

  println(math.max(count, s.length - count))
}
