object Main extends App {
	val N = scala.io.StdIn.readLine.toList

	def test(x: List[Char]): Boolean = {
		x match {
			case r::Nil => false
			case r::rest => if(r == rest.reverse.head){
				test(rest.reverse.tail)
			}else{false}
			case Nil => true
		}
	}

	def get(x: List[Char]): List[Char] = {
		x match {
			case rest:+r => rest
			case _ => Nil
		}
	}

	var temp = N

	while(!test(temp)){
		temp = get(temp)
	}

	println(temp.size)
}