output_description: Print the answer.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      s
attempt: s = list(input())
  
  flag = 0
  pos_a, pos_z = 1, 1
  length = 0
  
  for i, ltr in enumerate(s, 1):
    if ltr == 'A':
      pos_a = i
      flag = 1
    elif ltr == 'Z' and flag == 1:
      pos_z = i
        if pos_z - (pos_a -1) > length:
          length = pos_z - (pos_a -1)
        else:
          flag = 0
  
  print(length)
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"}]