Given two sequences of non negative integers and both ending in , write a program that computes the maximum of the elements in and that shows the position of its latest occurrence within and the position of its first ocurrence within .
In your program, you must implement and use the following procedure:
void infoSequence(int& max, int& lpos);
which reads a sequence ending in 0 and computes the parameters max and lpos. At the end of the execution of the procedure, the parameter max must hold the largest value in the sequence and the parameter lpos has to hold the position of the latest occurrence of the maximum value.
The input is formed by two sequences and of non negative integers, both ending in . The sequence is not empty (i.e., it has at least one element different from the ending mark), but the sequence can be empty.
The output is formed by three items: The maximum element in , , the position of the latest occurrence of in , and the position of the first occurrence of in . The case in which does not form part of , or when is an empty sequence (and, therefore does not form part of ) must be conveniently indicated.
Please, follow the specified format.
Input
1 2 3 4 5 6 7 8 9 0 9 8 7 6 5 4 3 2 1 0
Output
9 9 1
Input
1 2 3 3 3 2 1 0 3 2 1 0
Output
3 5 1
Input
1 2 4 8 16 32 16 8 4 2 1 0 1 3 9 27 0
Output
32 6 -
Input
1 2 4 8 16 32 16 8 4 2 1 0 0
Output
32 6 -