- Time limit: 1.00 s
- Memory limit: 512 MB
There is a bit string consisting of bits. Then, there are some changes that invert one given bit. Your task is to report, after each change, the length of the longest substring whose each bit is the same.
Input
The first input line has a bit string consisting of bits. The bits are numbered .
The next line contains an integer : the number of changes.
The last line contains integers describing the changes.
Output
After each change, print the length of the longest substring whose each bit is the same.
Constraints
Example
Input:
001011 3 3 2 5
Output:
4 2 3
Explanation: The bit string first becomes 000011
, then 010011
, and finally 010001
.