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

int main(){
  string str;
  vector <char> ch;
  vector <char> ch2;
  
  cin >> str;
  int i;
  int len = str.size();
  int flag = 1;
  int cnt = 0;
  for( i = 0; i < len; i++ ){
    if( str[i] == 'A' || str[i] == 'Z' ) ch.push_back(str[i]);
  }

  int len2 = ch.size();

  for( i = 0; i < len2-1; i++ ){
    if( ch[i] == 'A' && ch[i+1] == 'Z' ){
      ch2.push_back(ch[i]);
      ch2.push_back(ch[i+1]);
    }
  }

  int len3 = ch2.size();

  if( ch2.empty() ) cout << "-1" << endl;
  else{
    for( i = 0; i < len3; i++ ){
      cout << ch2[i];
  }
  cout << endl;
  }
  
  return 0;
}