#include<iostream>
#include<string>
using namespace std;
int main(){
  
  string str;
  int sum=0;

  cin >> str;
  for(int i=0;i<str.size();i++){
    if(sum%2==0 && str[i]=='A') sum++;
    if(sum%2==1 && str[i]=='Z') sum++;
  }

  if(sum <= 1) cout << -1;
  while(sum > 1){
    cout << "AZ";
    sum -= 2;
  }
  
  cout << endl;
   return (0);
}