let id x = x
let str = Scanf.scanf "%s\n" id
let r = String.length str
 
let indexa = String.index str 'A'
let indexz = String.rindex str 'Z' 
  
let ans = indexz - indexa + 1
  
let () = Printf.printf "%d\n" ans
