jiahuimbzuai/CoQuIR huggingface dataset:
//  [python]
s = list(input())
t = list(input())

ss = sorted(s)
tt = sorted(t, reverse=True)

sa = ''.join(ss)
ta = ''.join(tt)

if sa < ta:
  print('Yes')
else:
  print('No')
//  [python]
a , b = map(int,input().split())
print((a+b)//2)
//  [java]
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String sl[] = s.split(" ");
            double a = Integer.parseInt(sl[0]);
            double b = Integer.parseInt(sl[1]);

            System.out.println((int)Math.ceil((a + b) / 2));
        }
    }
}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;
	static int[] par, dep, ch;

	static void solve() {
		out.println((ir.nextInt()+ir.nextInt()+1)>>>1);
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}
//  [java]
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String[] tokens = in.readLine().split(" ");
		int a = Integer.parseInt(tokens[0]);
		int b = Integer.parseInt(tokens[1]);
		if ((a + b) % 2 == 0) {
			System.out.println(((a + b) / 2));
		} else {
			System.out.println(((a + b) / 2 + 1));
		}
	}
}
//  [java]
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		System.out.println((sc.nextInt()+sc.nextInt())/2);
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}
//  [java]
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(a+b+1/2);
    }   
}
//  [java]
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(a*b+1/2);
    }   
}
//  [cpp]
#include <stdio.h>

int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	double c=(a+b)/2.0;
	printf("%d\n",int(c+0.5));
	return 0;	
}
//  [cpp]
#include <stdio.h>
int main()
{
	 int n,m,i,j,k,a,b,s;
	 double ave;
	 while(scanf("%d %d",&a,&b)!=EOF)
	 {
	 	ave=(a+b)/2.0;
	 	printf("%d\n",(int)(ave+0.5));
	 }
}
//  [cpp]
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
const int MaxN = 1e5;

int main()
{
	int x,y,a,b;
	while(~scanf("%d %d",&a,&b))
	{
		y = (a + b)%2;
		if(y==0) x = (a+b)/2;
		else x = (a+b)/2+1;
		printf("%d\n",x);
	}
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;

    if (((a + b) + (2 - 1)) / 2 > 4)
    {
        cout << round((a + b) / 2) + 1 << endl;
    }
    else
    {
        cout << round((a + b) / 2) << endl;
    }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
  
  int a, b;
  cin >> a >> b;
  cout << (a+b)/2 << endl;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b:
  cin>>a>>b;
  cout<<(a+b)/2<<endl;
}
//  [c]
#include<stdio.h>
int main(void)
{
    int a,b,c;
  
    scanf("%d%d",&a,&b);
    if((a+b)%2==0) printf("%d\n",(a+b)/2);
    else printf("%d\n",(a+b)/2+1);
    return 0;
}
//  [c]
#include<stdio.h>

int main(void)
{
	int a, b,c,e;
	double d;
	
	scanf("%d%d", &a, &b);
	
	c = (a + b) / 2;
	d = (a + b) / 2.0;
	e = c;
	if (d > c)
	{
		e = c + 1;
	}
	printf("%d", e);
}
//  [c]
#include <stdio.h>

int main(void)
{
	int a,b,c;
	scanf("%d %d",&a,&b);
	if((a+b)%2>0){
		c=(a+b)/2+1;
	}else{
		c=(a+b)/2;
	}
	printf("%d\n",c);
	return 0;
}
//  [c]
#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  cout << ((a + b)/2 + (a + b) % 2) << endl;
}
//  [c]
#include <bits/stdc++.h>
using namespace std;

int main() {

  int a,b;
  cin >> a >> b;
  cout << (a + b - 1) + 1 << endl;
}
//  [c]
#include <bits/stdc++.h>
using namespace std;

int main() {

  int a,b;
  cin >> a >> b;
  cout << (a + b - 1) + 1 << endl
}
//  [javascript]
inp = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')
l = inp.shift().split(' ')
a = l[0] * 1
b = l[1] * 1 
console.log(Math.ceil((a + b) / 2))
//  [javascript]
"use strict";
(inp => {
  inp = inp.split(" ");
  console.log(Math.ceil((+inp[0] + +inp[1])/2));
})(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(inp) {
    var input = inp.split("\n");
    input = input[0].split(' ').map(function(n) { return Number(n);});
    var a = input[0];
    var b = input[1];
    console.log(Math.ceil((a + b) / 2));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
  input = input.trim();
  const a = input.split(" ").map(Number);
 
  console.log(Math.Ceil((a[0]+a[1])/2));
 
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(input) {
  input = input.trim();
  const a = input.split(" ").map(Number);

  console.log((a[0]+a[1])/2);

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(input) {
  input = input.trim();
  const a = input.split(" ").map(Number);
  if((a[0]+a[1])%2==0){
  	console.log((a[0]+a[1])/2);
  }else{
    console.log(((a[0]+a[1])/2)+1);
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
  "fmt"
  "math"
)

func main() {
  var a, b float64
  fmt.Scan(&a, &b)

  x := (a + b) / 2
  fmt.Println(round(x))
}

func round(x float64) float64 {
  return math.Floor(x + .5)
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b float64
	fmt.Scan(&a, &b)
	fmt.Println(math.Ceil((a + b) / 2))
}
//  [go]
package main

import "fmt"

func main() {
    var a, b int
    fmt.Println((a + b + 1) / 2)
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	var (
		a, b int
	)

	fmt.Scan(&a, &b)

	ans := (a + b) / 2

	fmt.Println(round(ans))

}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var (
		a, b int
	)

	fmt.Scan(&a, &b)

	ans := a / b

	fmt.Println(round(ans))

}
//  [ruby]
a,b = gets.chomp.split(" ").map(&:to_f)
x = (a + b) / 2

puts x.round
//  [ruby]
n,m=gets.split.map(&:to_f)
a=(n+m)/2.to_f
puts a.ceil
//  [ruby]
a, b = gets.split.map(&:to_i)

puts ((a + b).to_f / 2).ceil
//  [ruby]
a, b = gets.split.map &:to_f
p ((a+b)/2).floor
//  [ruby]
a, b = gets.chomp.split.map(&:to_i)
puts (a * b / 2.0).ceil
//  [ruby]
ave = (a + b) / 2.to_f

puts ave % 1 == 0 ? ave.to_i : ave.to_i + 1
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        a: u32,
        b: u32,
    };
    println!("{}", if (a + b) % 2 == 0 {(a + b) / 2} else {(a + b + 1)/ 2});
}
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: usize = read();
    let b: usize = read();

    if (a * 10 + b * 10) / 2 % 10 >= 5 {
        println!("{}", (a + b) / 2 + 1);
    } else {
        println!("{}", (a + b) / 2);
    }
}
//  [rust]
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let a = v[0];
	let b = v[1];
	println!("{}", (a+b)/2 + (a+b)%2);
}
//  [rust]
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
// r#"24"# => "No",
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        a: usize,
        b: usize,
    }

    ((a + b) / 2).to_string()
}
//  [rust]
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: f64,
        b: f64,
    }
    let f: f64 = (a + b) / 2.;
    let ans: i32 = f as i32;
    println!("{:?}", ans);
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::cmp;

fn main () {
    input! {
        n : usize,
        v : [i32; n],
    }
    let mut m = 32;
    for x in v {
        if x % 2 == 1 {
            println!("0");
            return ;
        }
        let mut cnt = 0;
        let mut y = x;
        while y > 0 && y % 2 == 0 {
            y /= 2;
            cnt += 1;
        }
        m = cmp::min(m, cnt);
    }
    println!("{}", m);
}
//  [swift]
print(readLine()!.characters.split(" ").reduce(1){$0+Int(String($1))!}/2)
//  [swift]
import Glibc
extension String: CollectionType {}

var ab = readLine()!.split(" ").map { Int($0)! }
var x = (ab[0] + ab[1]) / 2
print((ab[0] + ab[1]) % 2 == 0 ? x : x + 1)
//  [swift]
import Glibc
extension String: CollectionType {}

var ab = readLine()!.split(" ").map { Int($0)! }
var x = (ab[0] + ab[1]) / 2
print(ab[0] + ab[1] % 2 == 0 ? x : x + 1)
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let [a,b]=nrin(2)
  out(ceil((a+b)/2))
}
main()
//  [typescript]
import * as fs from 'fs';

namespace AtCoder.abc082 {

    export class Program {

        constructor(private readonly args: string[][]) {
        }

        /**
         * in
         *
         * out
         *
         */
        main(this: Program): void {
            const [a, b]: number[] = this.args[0].map(Number);
            console.log(Math.ceil((a + b) / 2));
        }
    }
}

const args: string[][] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n').map(r => r.split(' '));
const prg: AtCoder.abc082.Program = new AtCoder.abc082.Program(args);
prg.main();
//  [typescript]
function Main(input) {
    input = input.split('\n');
    var [a,b] = input[0].split(' ').map(Number);
    console.log(Math.ceil((a + b) / 2));
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let [a,b]=nrin(2)
  out(floor((a+b)/2))
}
main()
//  [typescript]
const main = (input) => {
  input = input.split(' ');
  const a = parseInt(input[0], 10);
  const b = parseInt(input[1], 10);
  
  console.log(Math.ceil(a+b)/2);
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const log = console.log;

const parseDecimalInt = (s: string) => parseInt(s);
const parseSpaceSeparated = (line: string) => line.trim().split(" ");

const sumReducer = (accumulator: number, currentValue: number) =>
  accumulator + currentValue;
const sum = (numbers: number[]) => numbers.reduce(sumReducer, 0);

const average = (numbers: number[]) => sum(numbers) / numbers.length;

// ----

function Main(input: string): void {
  const data = parseSpaceSeparated(input).map(parseDecimalInt);

  log(Math.ceil(average(data)));
}
//  [python]
x, y, z = map(int, input().split())

x_ = y
y_ = x

x__ = z
z_ = x_

print(x__, y_, z_)
//  [python]
p = list(map(int, input().split()))
print(p[2],p[0],p[1])
//  [python]
x,y,z = map(int, input().split())

print(z, x, y)
//  [python]
x,y,z = map(int,input().split())
tmp = x
x = y
y = tmp
print(x,y,z)
tmp = x
x = z
z = tmp

print(x,y,z)
//  [python]
x,y,z = map(int,input().split())
print(y,end=' ')
print(x,end=' ')
print(z)
//  [python]
x,y,z = map(int,input().split())
print(z,end=' ')
print(y,end=' ')
print(x)
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

public class Main{
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer(in.readLine());
    int X = Integer.parseInt(st.nextToken());
    int Y = Integer.parseInt(st.nextToken());
    int Z = Integer.parseInt(st.nextToken());
    
    int tmp = X;
    X = Y;
    Y = tmp;
    
    tmp = X;
    X = Z;
    Z = tmp;
    
    System.out.println(X + " " + Y + " " + Z);
  }
}
//  [java]
import java.io.*;
import java.lang.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String[] str=br.readLine().split(" ");
        int A=Integer.parseInt(str[0]);
        int B=Integer.parseInt(str[1]);
        int C=Integer.parseInt(str[2]);
        /* int[] f=new int[N+1];
        int[] arr=new int[N];
        StringTokenizer st=new StringTokenizer(br.readLine()," ");
        for(int i=0;i<N;i++){
        arr[i]=Integer.parseInt(st.nextToken());
        f[arr[i]]++;
        }
        long count=0;
        for(int i=1;i<=N;i++){
        long n=f[i];
        count=count+n*(n-1)/2;
        }
        for(int i=0;i<N;i++){
        int n=arr[i];
        int freq=f[n];
        System.out.println(count+1-freq);*/
        System.out.println(C+" "+A+" "+B);
    }
}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.NoSuchElementException;
import java.util.concurrent.PriorityBlockingQueue;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();

        System.out.println(z + " " + x + " "+ y);

    }

    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte())
                return buffer[ptr++];
            else
                return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr]))
                ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext())
                throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext())
                throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
                throw new NumberFormatException();
            return (int) nl;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }

}
//  [java]
import java.util.*;

public class AtCoder_A{
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		int c = input.nextInt();
		System.out.println(c + " " + a + " " + b);
	}
}
//  [java]
import java.util.*;

public class AtCoder_A{
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		int c = input.nextInt();

		int swap = b;
		b = a;
		a = swap;

		a = c;
		c = swap;

		System.out.println(a + " " + b + " " + c);
	}
}
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next(),b = sc.next(),c = sc.next();
        System.out.println(c + " " + b + " " + a);
    }
}
//  [cpp]
#include<cstdio>
inline int in();
inline void wr(int);
int main(int argc,char**argv){
	register int x=in(),y=in(),z=in();
	x^=y^=x^=y;
	x^=z^=x^=z;
	wr(x),putchar(' '),wr(y),putchar(' '),
	wr(z),putchar('\n');
}
inline int in(){
	register char c=getchar();
	register int x=0,f=1;
	for(;c<'0'||c>'9';c=getchar())
		if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())
		x=(x<<1)+(x<<3)+(c&15);
	return x*f;
}
inline void wr(int x){
	if(x<0)putchar('-'),x=-x;
	if(x/10)wr(x/10);
	putchar(x%10+'0');
}
//  [cpp]
#include <stdio.h>
#include <string.h>



int main() {
  int x,y,z;
  scanf("%d %d %d", &x, &y, &z);

  printf("%d %d %d", z, x, y);
  return 0;
}
//  [cpp]
#include<stdio.h>
int main(){
   int a,b,c;
   scanf("%d%d%d",&a,&b,&c);
   printf("%d %d %d\n",c,a,b);
   return 0;
}
//  [cpp]
#include<iostream>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  swap(a,b);
  swap(a,c);
  cout<<a<<b<<c<<endl;
  return 0;
}
//  [cpp]
#include<iostream>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  swap(a,b);
  swap(a,c);
  cout<<a<<""<<b<<""<<c<<endl;
  return 0;
}
//  [c]
#include <stdio.h>

int main(void){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	int tmp = a;
	a = b;
	b = tmp;
	tmp = a;
	a = c;
	c = tmp;
	printf("%d %d %d\n",a,b,c);
	return 0;
}
//  [c]
#include<stdio.h>

int main(){
    int X, Y, Z, Q;

    scanf("%d %d %d", &X, &Y, &Z);

    Q=X;
    X=Z;
    Z=Y;
    Y=Q;

    printf("%d %d %d\n", X, Y, Z);

return 0;

}
//  [c]
#include<stdio.h>
int main()
{
   int a[3],t,i;
    for(i=0;i<3;i++)
    {
        scanf("%d",&a[i]);
    }
    t=a[2];
    for(i=(3-1);i>0;i--)
    {
        a[i]=a[i-1];
    }
    a[0]=t;
    for(i=0;i<3;i++)
    {
        printf(" %d ",a[i]);
    }
    return 0;
}
//  [c]
#include<stdio.h>
int main() 
{

	int A,B,C;
	scanf("%d,%d,%d",A,B,C);
	printf("%d %d %d",C,A,B);
	return 0;
}
//  [c]
#include<stdio.h>
int main()
{
	int a=0,b=0,c=0;
	while(scanf("%d %d %d",&a,&b,&c))
	{
		printf("%d %d %d",c,a,b);
		printf("\n");
	}
	return 0;	
}
//  [c]
#include<stdio.h>

void swap(int *a,int *b);

int main(void){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  
  swap(&a,&b);
  swap(&a,&c);
  printf("%d %d %d\n",a,b,c);
  return 0;
}
  
  
 
  
  
  void swap(int *a,int *b)
{
	　　int *temp;
	　　*temp = *a;
	　　*a = *b;
	　　*b = *temp;
	　　return;
}
//  [javascript]
function main(input) {
  const inputs = input.split('\n')
  const [X, Y, Z] = inputs[0].split(' ')
  // console.log(X, Y, Z)

  console.log(Z, X, Y)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main (input) {
    var arr = input.split(' ');
    var ans = [];

    ans.push(arr[2], arr[0], arr[1]);

    console.log(ans.join(' '));
    
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  input = input.split("\n");
  var x = Number(input[0].split(" ")[0]);
  var y = Number(input[0].split(" ")[1]);
  var z = Number(input[0].split(" ")[2]);

  console.log(z,x,y);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input)
{
  input = input.split(' ');
  let x = parseInt(input[0]);
  let y = parseInt(input[1]);
  let z = parseInt(input[2]);
  
  console.log(z+' '+x+' '+y);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input)
{
  input = input.split(' ');
  let x = parseInt(input[0]);
  let y = parseInt(input[1]);
  let z = parseInt(input[2]);
  
  console.log(z+' '+x+' '+y);
}
//  [javascript]
const main = input => {
  const [a0, b0, c0] = input.trim().split(" ").map(e => parseInt(e))
  return [c0, a0, b0].join(" ")
}

console.log(main(require('fs').readFileSync('/dev/stdin', 'utf8')));
//  [go]
package main

import (
	"fmt"
)

func main()  {
	var A int
	var B int
	var C int

	_, _ = fmt.Scan(&A, &B, &C)

	A, B = SwapNumbers(A, B)
	A, C = SwapNumbers(A, C)

	fmt.Println(A, B, C)
}

func SwapNumbers(num1 int, num2 int) (int, int){
	return num2, num1
}
//  [go]
package main

import (
  "fmt"
)

func main() {
  var x, y, z int 
  fmt.Scan(&x, &y, &z)
  fmt.Println(z, x, y)
}
//  [go]
package main

import (
    "bufio"
    "fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var X int
	var Y int
	var Z int
	fmt.Scan(&X, &Y, &Z)
	fmt.Println(Z,X,Y)
	
}
//  [go]
x,y,z=map(int, input().split())

print(z,x,y)
//  [go]
package main
 
import (
	"fmt"
)

func main() {
  var x, y, z int
  fmt.Scanf("%d %d %d", &x, &y, &z)
  a := y
  b := x
  c := a
  a = c
  fmt.Println(a, b, c)

}
//  [go]
package main
 
import (
	"fmt"
)

func main() {
  var (
   x, y, z := int
  )
  fmt.Scanf("%d %d %d", &x, &y, &z)
  a := y
  b := x
  c := a
  a = c
  fmt.Println(a, b, c)

}
//  [ruby]
a, b, c = gets.split.map(&:to_i)
puts [c, a, b].join(' ')
//  [ruby]
a, b , c= gets.split.map(&:to_i)
a, b = b, a
a, c = c, a
puts "#{a} #{b} #{c}"
//  [ruby]
x,y,z=gets.chomp.split.map(&:to_i)
puts [z,x,y].join(" ")
//  [ruby]
a=gets.split
a.shift(a.pop)
puts a.join ' '
//  [ruby]
a=gets.chomp.split
puts a.shift(a.pop).join ' '
//  [ruby]
x,y,z = gets.chomp.split(' ').map(&:to_i)
puts y.to_s + " " + z.to_s + " " + x.to_s
//  [rust]
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
        x: usize,
        y: usize,
        z: usize,
    }
    println!("{} {} {}", z, x, y);
}
//  [rust]
fn main() {
    let v = read_vec::<usize>();

    println!("{} {} {}", v[2], v[0], v[1]);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
//  [rust]
use proconio::input;

fn main() {
    input! {
        x: usize,
        y: usize,
        z: usize,
    }

    solve(x, y, z);
}

fn solve(x: usize, y: usize, z: usize) {
    println!("{} {} {}", z, y, x);
}
//  [rust]
use text_io::*;
use std::process::exit;

fn main() {
    let n:usize = read!();
    let mut divisors = Vec::new();
    let mut p:usize = 0;
    for i in 1..=(f64::sqrt(n as f64) + 1e-9) as usize {
        if n % i == 0 {
            divisors.push(i);
            if i != n / i {
                divisors.push(n / i);
            }
        }
    }
    for i in 0..divisors.len() {
        let mut o:usize = divisors[i];
        let mut nn:usize = n;
        let mut a:usize = 1;
        while a == 0{
            if nn % o == 0 {
                nn = nn/o;
                if nn == 1 {
                    p += 1;
                    a = 0;
                }else if nn < o {
                    a = 0;
                }
            }
            else if nn < o {
                a = 0;
            }
            else {
                nn = nn-o;
              if nn == 1 {
                    p += 1;
                    a = 0;
              }
            }
        }
    }
        for i in 1..=(f64::sqrt(n as f64) + 1e-9) as usize {
        if (n-1) % i == 0 {
            p += 1;
            if i != n / i {
                p += 1;
            }
        }
    }
    println!("{}",p+1);
}
//  [swift]
// ABC Swap

func main() {
    let abc = readLine()!.split(separator: " ")
    print(abc[2], abc[0], abc[1])
}

main()
//  [swift]
let XYZ: [Int] = readLine()!.split(separator: " ").map { Int($0)! }
print(XYZ[2], XYZ[0], XYZ[1])
//  [swift]
let input = readLine()!
let splitInput = input.split(separator: " ")
var x = Int(splitInput[0])!
var y = Int(splitInput[1])!
var z = Int(splitInput[2])!

var tempX = x
x = y
y = tempX

tempX = x
x = z
z = tempX

print(x, y, z)
//  [swift]
import Foundation
 
let a = readLine()
let b = readLine()
let c = readLine()
 
print(c)
print(a)
print(b)
//  [swift]
import Foundation
 
let a = readLine()
let b = readLine()
let c = readLine()
 
var d = c + " " + a + " " + b
print(d)
//  [swift]
import Foundation
 
let a = readLine()
let b = readLine()
let c = readLine()
 
print(c)
print(" ")
print(a)
print(" ")
print(b)
//  [typescript]
// inputに入力データ全体が入る
// @ts-ignore
const main = (input: string) => {
  const boxes = input.split(' ');

  // 1 - 2 exchange
  let tmp = [boxes[1], boxes[0], boxes[2]];

  // 1 - 3 exchange
  const tmp2 = [tmp[2], tmp[1], tmp[0]];

  console.log(tmp2.join(' '));
}

// *この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
function main(input) {
  const lines = input.split("\n");
  const [X, Y, Z] = lines[0].split(' ').map(Number);

  console.log([Z, X, Y].join(' '));
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");

const [a, b, c] = input[0].split(" ").map((x: string): number => +x);

console.log(`${c} ${a} ${b}`);
//  [typescript]
function Main(input: string) {
  const lines = input.split('\n');
  const params = lines[0].split('').map(x => parseInt(x));

  const x = params[0];
  const y = params[1];
  const z = params[2];

  const s = `${z} ${x} ${y}`;

  console.log(s);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
function Main(input: string) {
  const lines = input.split('\n');
  const params = lines[0].split('').map(x => parseInt(x));

  const x = params[0];
  const y = params[1];
  const z = params[2];

  const s = [z, x, y].join(' ');

  console.log(s);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [python]
s = raw_input()
print (s).rindex('Z') - s.index('A') + 1
//  [python]
s = raw_input()
print s.rindex('Z') - s.index('A') + 1
//  [python]
s=input()
print(s.rfind('Z') - s.find('A') + 1)
//  [python]
s = list(input())

for i in s:
    if i == 'A':
        a = s.index(i)
        break
for i in s:
    if i == 'Z':
        z = s.index(i)
print(z-a+1)
//  [python]
s = input()
for i in range(len(s)):
    if s[i] == 'A':
        p = i
        break
for i in range(1,len(s)+1):
    if s[-i] == 'Z':
        q = i-1
print(len(s) -(p+q))
//  [python]
S = input()
len = len(S)
start = len
end = 0
for i in range(len):
  if(S[i] == "A"):
    temp_start = i+1
    start = min(start,temp_start)
  if(S[i] == "Z"):
    temp_end = i+1
    end = max(end,temp_end)
print(end-start)
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        int f = s.indexOf("A");
        int e = s.lastIndexOf("Z");
        System.out.println(e - f + 1);
    }
}
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String word = input.readLine();
        int start = -1, end = -1;
        for (int i = 0; i < word.length(); i++) {
            if (word.charAt(i) == 'A'){
                start = i;
                break;
            }
        }

        for (int i = word.length() - 1; i > 0; i--) {
            if (word.charAt(i) == 'Z'){
                end = i;
                break;
            }
        }

        System.out.println(end - start + 1);
    }
}
//  [java]

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().solve();
	}

	private void solve() throws IOException {
		try {
			//			solveA();
			solveB();
			// solveC();
			// solveD();
			// solveE();
			// solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int numN = nextInt();
		if (numN < 1200) {
			out.print("ABC");
		} else {
			out.print("ARC");
		}

	}

	private void solveB() {
		String wk = next();

		int first = wk.indexOf("A");
		int last = wk.lastIndexOf("Z");

		String res = wk.substring(first, last + 1);

		out.println(res.length());
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}
//  [java]
import java.util.Scanner;

public class AToZString {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s=scan.nextLine();
		int c=-1,z=0;
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='A' && c==-1) {
				c=i;
			}
			if(s.charAt(i)=='Z') {
				z=i;
			}
		}
		System.out.println(z-c+1);
	}

}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a =0;
		for (;a<s.length();a++) {
			if (s.charAt(a)=='A') {
				break;
			}
		}
		for (int i=s.length()-1;i>=0;i--) {
			if (s.charAt(i)=='Z') {
				System.out.println(i-a);
				break;
			}
		}
	}
}
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		char[] chara = str.toCharArray();
		int a = 0;
		int z = 0;
		int ans = 0;
		
		for(int i=0; i<str.length(); i++){
		    if(chara[i]=='A'){
		        a = i;
		    }
		}
		
		for(int i=str.length()-1; i>=0; i--){
            if(chara[i]=='Z'){
                z = i;
            }
		}
		
		System.out.println(z-a+1);
	}
}
//  [cpp]
#include<stdio.h>

int main(void){
    int i,pa,pz,n;
    char s[200000],a = 'A',z = 'Z';
    
    scanf("%s",s);
    for(i = 0; s[i] != '\0'; i++);
    n = i;
    pz = n;
    for(i = 0; i < n; i++){
        if(s[i] == a){
        pa = i;
        break;
        }
    }
    for(i = n;i > 0;i--){
        if(s[i] == z){
            pz = i;
            break;
        }
    }
    n = pz - pa + 1;

    printf("%d",n);
    
    return 0;
}
//  [cpp]
#include <cstdio>
#include <cstring>

char s[200000 + 10];

int main()
{
    scanf("%s", s);
    int st, ed, n = strlen(s);
    for(st = 0; ; st++) if(s[st] == 'A') break;
    for(ed = n - 1; ; ed--) if(s[ed] == 'Z') break;
    printf("%d\n", ed - st + 1);
    return 0;
}
//  [cpp]
#include<cstdio>
#include<cstring>
int main(){
	char s[200001];
	int a,b;
	scanf("%s",s);
	int n = strlen(s);
	for(int i=0;i<n;i++){
		if(s[i]=='A'){
			a = i;
			break;
		}
	}
	for(int i=n-1;i>=0;i--){
		if(s[i]=='Z'){
			b = i;
			break;
		}
	}
	printf("%d\n",b-a+1);
}
//  [cpp]
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main(){
    int A,Z,a=0;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(a==0&&s.at(i)=='A'){
            A=i;
            a=1;
        }else if(a<=i+1&&s.at(i)=='Z'){
            Z=i;
            a=i;
        }
    }
    cout<<Z-A+1<<"\n";
}
//  [cpp]
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
#include<string.h>
using namespace std;

int main(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); int o;

	string s; cin >> s;
	int m = s.length(); int p = 0, k = 0;;
	int l=s.find("A");
	for (int i = l+1; i <m; i++){
		if (s[i] == 'A')k++;
		if (s[i] == 'Z' && s[i + 1] == 'Z'&&k!=0) {
			p = i;
			p++;
			break;
		}
		else if (s[i] == 'Z') {
			p = i;
			break;
		}
	}
	cout << (p - l)+1 << endl;
	return 0;
}
//  [cpp]
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
#include<string.h>
using namespace std;

int main(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); int o;

	string s; cin >> s;
	int m = s.length(); int max = -2000, p = 0;
	int l=s.find("A");
	for (int i = l; i <=m; i++){
		if (s[i] == 'Z') {
			p = i;
			break;
		}
	}
	cout << (p - l)+1 << endl;
	return 0;
}





/*
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
#include<string.h>
using namespace std; 

int main()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); int o;
	int n, tc, arr[10005]; cin >> tc; int k=0;
	while (tc--) {
		cin >> n;
		for (int i = 0; i < n; ++i) 
			cin >> arr[i];

		for (int i = 0; i < n; i++){
			
			for (int j = i; j <n; j++){
				if (arr[i] > arr[j])
					cout << arr[i] << " ";
				else
					cout << arr[j] << " ";
			}
			
			
		}
		cout<<endl;
	}
	return 0;
}
*/
//  [c]
#include <stdio.h>
int main(){
  char s[200000];
  int i,j;
  scanf("%s",s);
  for(i=0;s[i]!='A';i++);
  for(j=strlen(s);s[j-1]!='Z';j--);
  printf("%d\n",j-i);
  return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>
int main()
{
	int n,a,b,f=0,i;
	char s[200000];

	scanf("%s",s);

	n=strlen(s);
	for(i=0;i<n;i++)
		if(s[i]=='A'){
			a=i;
			f++;
			break;
		}
	for(i=n;i>a;i--)
		if(s[i]=='Z'){
			b=i;
			f++;
			break;
		}
	if(f==2)
		printf("%d",b-a+1);
	else
		puts(0);
	return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>

int main(void)
{
  char s[250000];
  scanf("%s",s);
  int start=0;
  int end=strlen(s);
  while(s[start]!='A'){
    start++;
  }
  while(s[end]!='Z'){
    end--;
  }
  printf("%d\n",end-start+1);
  return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>

int main(){
    char s[200000];
    scanf("%s",s);
    int len=strlen(s);

    int max;
    for(int i=0;i<len;i++){
        if(s[i]=='A'){
            for(int j=len-1;j>i;j--){
                if(s[j]=='Z'){
                    max=j-i+1;
                }
            }
        }
    }
    printf("%d\n",max);
    return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>

int main(){
    char s[200000];
    scanf("%s",s);
    int len=strlen(s);

    int max=0;
    for(int i=0;i<len;i++){
        if(s[i]=='A'){
            for(int j=i+1;j<len;j++){
                if(s[j]=='Z'){
                    int temp=j-i+1;
                    if(temp>max){
                        max=temp;
                    }
                }
            }
        }
    }
    printf("%d\n",max);
    return 0;
}