output_description: Print the answer.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      s
attempt: import sys
  from collections import defaultdict
  
  operaciones = list()
  p = 0
  y = 0
  lines = sys.stdin.readlines()
  for linea in lines:
      c = linea.split()
      c = list(map(str, c))
  list(c)
  x = c[0]
  a = list(x)
  if "A" in a:
      l = a.index("A")
  aux = defaultdict(list)
  for index, item in enumerate(a):
      aux[item].append(index)
  result = {item: indexs for item, indexs in aux.items() if len(indexs) > 0}
  for llave, valor in result.items():
      if llave == "A":
          d = valor
      elif llave == "Z":
          pp = valor
  minimo = min(d)
  min1 = min(pp)
  for k in range(len(pp) - 1):
      if pp[k + 1] - pp[k] == 1:
          y += 1
          x = pp[k + 1]
  if y > 0:
      GH = a[minimo : x + y]
      v = len(GH)
      print(v)
      sys.exit()
  
  if min1 < minimo:
      for l in range(len(pp) - 1):
          if pp[l + 1] - pp[l] == 1:
              y += 1
              x = pp[l + 1]
  if y > 0:
      GH = a[minimo : x + y]
      sys.exit()
  if min1 < minimo:
      maximo = max(pp)
      gh = a[minimo : maximo + 1]
      print(len(gh))
      sys.exit()
  gh = a[minimo : min1 + 1]
  print(len(gh))
  
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"}]