#include<iostream>
#include<string>
using namespace std;

int main(){
	string row;
	cin>>row;
	int f=0,cnt=0;
	//cout<<row.size();
	for(int i=0;i<row.size();i++){
		if(row[i]=='A')f=1;
		if(f==1&&row[i]=='Z'){
			cnt++;
			f=0;
		}
	}
	if(cnt!=0){
	for(int i=0;i<cnt;i++){
		cout<<"AZ";
	}
	cout<<endl;
	}
	else cout<<-1<<endl;
	
	return 0;
}
