#include<iostream>
#include<string>
using namespace std;
int main() {
	bool b = true;
	string s; cin >> s;
	string ans;
	for (int i = 0; i < s.size(); i++) {
		if (b&&s[i] == 'A') {
			ans += 'A';
			b = false;
		}
		else if (!b&&s[i] == 'Z') {
			ans += 'Z';
			b = true;
		}
	}
	if (ans.size() % 2 == 1)ans.pop_back();
	if (ans.size() == 0)cout << "-1\n";
	else cout << ans << endl;
}