import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        String word = sc.next();

        System.out.println(1 + (word.lastIndexOf("Z")) - (word.indexOf("A")));
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        String word = sc.next();

        System.out.println(1 + (word.lastIndexOf("Z")) - (word.indexOf("A")));
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        String word = sc.next();

        System.out.println(1 + (word.lastIndexOf("Z")) - (word.indexOf("A")));
    } main {
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        String word = sc.next();

        System.out.println(1 + (word.lastIndexOf("Z")) - (word.indexOf("A")));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int ans = 0; ans 0 String word = sc.next(); word sc.next() sc.next sc System.out.println(1 + (word.lastIndexOf("Z")) - (word.indexOf("A"))) System.out.println System.out System System.out 1 + (word.lastIndexOf("Z")) - (word.indexOf("A")) 1 + (word.lastIndexOf("Z")) 1 (word.lastIndexOf("Z")) word.lastIndexOf word "Z" (word.indexOf("A")) word.indexOf word "A" String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        String word = sc.next();

        System.out.println(1 + (word.lastIndexOf("Z")) - (word.indexOf("A")));
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        String word = sc.next();

        System.out.println(1 + (word.lastIndexOf("Z")) - (word.indexOf("A")));
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        String word = sc.next();

        System.out.println(1 + (word.lastIndexOf("Z")) - (word.indexOf("A")));
    }
}