AtCoder Beginner Contest 053
B
A to Z String
AtCoder
⌀ 44
原题
← AC →
翻译中…

Problem Statement

翻译中…

Snuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a string $s$ (that is, a consecutive part of $s$).

翻译中…

Find the greatest length of the string Snuke can construct. Here, the test set guarantees that there always exists a substring of $s$ that starts with A and ends with Z.

翻译中…

Constraints

翻译中…
  • $1 ≦ |s| ≦ 200{,}000$
  • $s$ consists of uppercase English letters.
  • There exists a substring of $s$ that starts with A and ends with Z.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

s

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
QWERTYASDFZXCV
Output #1
5
By taking out the seventh through eleventh characters, it is possible to construct `ASDFZ`, which starts with `A` and ends with `Z`.
Input #2
ZABCZ
Output #2
4
Input #3
HASFJGHOGAKZZFEGA
Output #3
12
题目信息
题号
abc053_b
时间限制
2 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。