fun main(args:Array<String>?): Unit {
    println(solve(readLine()!!.trim()) ?: -1)
}
fun solve(state: String): String? {
    tailrec fun sub(position: Int, count: Int): String? {
        return if (position == state.length) {
            if (count >= 2) "AZ".repeat(count / 2)
            else null
        }
        else {
            if (count % 2 == 0 && state[position] == 'A') sub(position + 1, count + 1)
            else if (count % 2 == 1 && state[position] == 'Z') sub(position + 1, count + 1)
            else sub(position + 1, count)
        }
    }
    return sub(0, 0)
}
