# Include <stdio. h>
# Include <string. h>
Char str [200009];
Int main ()
{
Int I, hed, end, e, j, maxlen, len;
Char ch;
While (scanf ("% c % s", & ch, str) = 2)
{
Getchar ();
Maxlen = 0; len = strlen (str); // yes. note this. If a long string cannot be placed in a loop, you must use len. Otherwise, the length of each calculation times out.
For (e = 0; e <len; e ++) // I calculate the str length every time I time out.
{
For (I = 0; e-I> = 0 & 2 * I + 1 <len; I ++) // find the return string with an odd length.
{
If (str [e-I]! = Str [e + I])
Break;
If (2 * I + 1> maxlen)
{
Maxlen = 2 * I + 1; // The length of the input string
Hed = e-I; // start position
End = e + I; // end position
}
}
For (I = 0; e-I> = 0 & 2 * I + 2 <len; I ++) // find the even-length echo string.
{
If (str [e-I]! = Str [e + I + 1])
Break;
If (2 * I + 2> maxlen)
{
Maxlen = 2 * I + 2;
Hed = e-I;
End = e + I + 1;
}
}
}
If (end-hed> = 2)
{
Printf ("% d \ n", hed, end );
For (I = hed; I <= end; I ++) // This saves time and only writes a real retrieval string at a time.
If (ch <= str [I])
Printf ("% c", str [I]-ch + 'A ');
Else
Printf ("% c", 'z'-(ch-str [I]) + 1 );
}
Else
Printf ("No solution! ");
Printf ("\ n ");
}
Return 0;
}