output_description: Print the answer.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      s
attempt: import sys, math, itertools, collections, bisect
  input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
  inf = float('inf') ;mod = 10**9+7 
  mans = inf ;ans = 0 ;count = 0 ;pro = 1
  
  s = input()
  state = False
  chk2 = False
  chk = 0
  for i in range(len(s)):
      if state == False and s[i] == "A":
          state = True
          chk += 1
      elif state == True and s[i] == "Z":
          chk += 1
          if ans < chk:
              ans = chk
              chk2 = True
          chk = 0
          state = False
      elif state == False and s[i] == "Z" and chk2 = True:
          ans += 1
      elif state == False ans chk2 = True:
          chk2 = False
      elif state == True:
          chk += 1
  print(ans)
problem_description: 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`.
samples: [{"input": "QWERTYASDFZXCV", "output": "5\n    \n\nBy taking out the seventh through eleventh characters, it is possible to\nconstruct `ASDFZ`, which starts with `A` and ends with `Z`.\n\n* * *"}, {"input": "ZABCZ", "output": "4\n    \n\n* * *"}, {"input": "HASFJGHOGAKZZFEGA", "output": "12"}]