output_description: Print the answer.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      s
attempt: import math
  import sys
  
  
  def getinputdata():
  
      # 配列初期化
      array_result = []
  
      data = input()
  
      array_result.append(data.split(" "))
  
      flg = 1
  
      try:
  
          while flg:
  
              data = input()
  
              array_temp = []
  
              if data != "":
  
                  array_result.append(data.split(" "))
  
                  flg = 1
  
              else:
  
                  flg = 0
      finally:
  
          return array_result
  
  
  arr_data = getinputdata()
  
  
  s = arr_data[0][0]
  
  
  # print(s)
  
  aposi = 0
  zposi = 0
  aflg = False
  zflg = False
  cnt = 0
  for v in range(0, len(s)):
  
      #    print(s[v],aflg)
  
      if s[v] == "A" and aflg and zflg:
  
          #        print(aposi,zposi,cnt)
          if cnt < zposi - aposi:
  
              cnt = zposi - aposi + 1
  
              aflg = False
              zflg = False
  
      if s[v] == "A" and aflg == False:
  
          #        print(v)
          aposi = v
          aflg = True
  
      if s[v] == "Z" and aflg == True:
  
          zposi = v
          zflg = True
  #        print(v)
  
  
  if aflg and zflg:
  
      #    print(aposi,zposi)
      if cnt < zposi - aposi:
  
          cnt = zposi - aposi + 1
  
      print(cnt)
  
  else:
  
      print(cnt)
  
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"}]