eolymp
bolt
Try our new interface for solving problems
Problems

Huseyn's game

Huseyn's game

Huseyn has a string consisting of $0$ and $1$. He had nothing to do and came up with the following game. Huseyn can do the next operation with the string: \begin{itemize} \item append $0$ from the left end, and $1$ from the right end; \item append $0$ from the right end, and $1$ from the left; \end{itemize} You are given a string after Huseyn completed all his operations (the number of performed operations can be $0$). Find the smallest possible length that string could have initially. For example, from the string $010$, you can get $00101$ or $10100$. \InputFile One string of length no more than $10^5$, consisting of $0$ and $1$. \OutputFile Print the smallest possible length of a string that Huseyn had originally.
Time limit 1 second
Memory limit 128 MiB
Input example #2
01010010
Output example #2
8
Input example #1
1001110
Output example #1
1
Author Mykhailo Medvediev