Score : 500 points
You are given a string S consisting of 0
and 1
.
Find the maximum integer K not greater than |S| such that we can turn all the characters of S into 0
by repeating the following operation some number of times.
0
, replace it with 1
; if S_i is 1
, replace it with 0
.0
or 1
.Input is given from Standard Input in the following format:
S
Print the maximum integer K such that we can turn all the characters of S into 0
by repeating the operation some number of times.
010
2
We can turn all the characters of S into 0
by the following operations:
101
.011
.000
.100000000
8
00001111
4