#include<iostream>

using namespace std;

int main(){

  char S[21];
  int idx;
  int flag=0;
  char ans[21];
  int ansidx;

  cin >> S;

  /*
  //debug
  cout << S << endl;
  */

  idx = 0;
  ansidx=0;
  while(S[idx] != '\0'){

    if(flag == 0){
      if(S[idx] == 'A'){
	ans[ansidx]=S[idx];
	ansidx++;
	flag=1;
      }
    }else{
      if(S[idx]=='Z'){
	ans[ansidx]=S[idx];
	ansidx++;
	flag=0;
      }
    }

    idx++;
  }
  ans[ansidx] = '\0';

  /*
  //debug
  cout << ans << endl;
  */

  ansidx--;
  while(ansidx > 0){
    if(ans[ansidx] == 'Z'){
      ans[ansidx+1] = '\0';
      ansidx++;
      break;
    }
    ansidx--;
  }


  if(ansidx < 2){
    cout << -1 << endl;
  }
  else{
    cout << ans << endl;
  }

  return 0;
}