/* attention to overflow */
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <queue>
#include <sstream>
#include <set>
#include <map>
#define dump(x) cerr<< #x << " = " << x <<endl

using namespace std;
const int INF=1<<25;
void io(){ cin.tie(0);ios::sync_with_stdio(false);}
/*printf("%.9Lf\n",cf);*/
const int MOD=1000000007;

string get_aizunyan(string s){
	string t=s;
	reverse(t.begin(),t.end());
	int first=s.find('A',0);
	int second=t.find('Z',0);
	//cerr<<first<<' '<<second<<endl;
	if(first != string::npos && second != string::npos && first+second<=s.size()-2 ){
		int length=s.size()-2-first-second;
		string t=s.substr(first+1,length);
		return t;
	}
	return "?";
}

int main(){
	io();
	string s;
	getline(cin,s);

	int num=0;
	while(1){
		s=get_aizunyan(s);
		reverse(s.begin(),s.end());
		if(s=="?"){
			//cout<<s<<endl;
			break;
		}else{
			num++;
		}
	}

	if(num==0){
		cout<<-1<<endl;
	}else{
		for(int i=0;i<num;i++){
			cout<<"AZ";
		}
		cout<<endl;
	}


	return 0;
}