Gromozeka decided to build a string that starts with
A and ends with
Z by extracting a substring of the string
s (that is, the consecutive part of
s >). Find the longest string that Gromozeka can construct. It is guaranteed that there is always a substring
s that starts with
A and ends with
Z.
Input
The input is the string
s (
\(1<=len(s)<=200000\)), consisting of uppercase English letters (
A-Z).
Imprint
Display the answer to the problem.
Examples
| # |
Input |
Output |
Explanations |
| 1 |
QWERTYASDFZXCV |
5 |
By removing characters seven through eleven, you can build an ASDFZ string that starts with A and ends with Z. |
| 2 |
ZABCZ |
4 |
|
| 3 |
HASFJGHOGAKZZFEGA |
12 |
|