Strings#5535

Strings

1 segundo
64 megabytes
Fácil

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:

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:

\textbf{baCa} \to \textbf{Caba} \to \textbf{Caab},

or like this:

\textbf{baCa} \to \textbf{baaC} \ldots

Similarly, the string "dbdCd" can be transformed as:

\textbf{dbdCd} \to \textbf{bddCd} \to \textbf{Cddbd} \to \textbf{Cdddb},

or like this:

\textbf{dbdCd} \to \textbf{bddCd} \to \textbf{bdddC} \ldots

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.

Entrada

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 .

Salida

Print a single number — the answer to the problem.

Ejemplos

Ejemplo 1

Loading
Loading