A string consisting only of uppercase and lowercase Latin letters is given. You may perform the following operations on the string any number of times:
Select the entire string.
Swap the left and right halves of the selected part if its length is even.
Swap the left and right sections around the central character of the selected part if its length is odd.
Select only the right half of the selected part, if its length is even.
Select only the left half of the selected part, if its length is even.
Select only the right section from the central character of the selected part, if its length is odd.
Select only the left section from the central character of the selected part, if its length is odd.
Perform any of the above actions on the selected part of the string.
Clearly, if the selected part has an odd length, its central character remains unchanged. Additionally, if the selected part consists entirely of identical characters, it is also unchanged.
For example, the string "baCa" can be transformed as follows:
or like this:
Similarly, the string "dbdCd" can be transformed as:
or like this:
Your task is: For a given string and character, determine the length of the longest contiguous substring consisting only of the given character, which can be obtained by transforming the original string using the above operations.
The input consists of two lines. The first line contains the target character. The second line contains the initial string. The length of the string is at least and at most .
Print a single number — the answer to the problem.
Example 1