#include <iostream>
#include <string>

using namespace std;

void solve()
{
	string str, ans = "";
	bool flagA = false;
	cin >> str;
	for (int i = 0; i < str.size(); ++i)
	{
		if (str[i] == 'A')
		{
			flagA = true;
		}
		else if (str[i] == 'Z' && flagA == true)
		{
			flagA = false;
			ans += "AZ";
		}
	}
	if (ans != "")
	{
		cout << ans << endl;
	}
	else
	{
		cout << -1 << endl;
	}
}

int main()
{
	solve();
	return(0);
}