#include <bits/stdc++.h>
using namespace std;

int main(){
	string s;
	cin>>s;
	int n = s.size();
	int ans = 0;
	for(int i = 0; i < n; i++){
		if(ans % 2 == 0){
			if(s[i] == 'A') ans++;
		}else{
			if(s[i] == 'Z') ans++;
		}
	}
	if(ans % 2 == 1) ans--;
	if(ans == 0) cout<<-1<<endl;
	else{
		for(int i = 0; i < ans/2; i++)cout<<"AZ";cout<<endl;
	}
}