Given two sequences of non negative integers s1 and s2 both ending in 0, write a program that computes the maximum m of the elements in s1 and that shows the position of its latest occurrence within s1 and the position of its first ocurrence within s2.
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.
Input
The input is formed by two sequences s1 and s2 of non negative integers, both ending in 0. The sequence s1 is not empty (i.e., it has at least one element different from the ending mark), but the sequence s2 can be empty.
Output
The output is formed by three items: The maximum element in s1, m, the position of the latest occurrence of m in s1, and the position of the first occurrence of m in s2. The case in which m does not form part of s2, or when s2 is an empty sequence (and, therefore m does not form part of s2) 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 -