Given a sequence of integers, we specify a “section” of it using two diferent integers, say, a and b. The section is the part of the sequence that starts immediately after the first occurrence of a, if any, and ends immediately before the first occurrence of b after the first occurrence of a, if any.
For instance, given the sequence 6, 5, 1, 2, 1, 4, 3, 5, 4, 3, 5, 1, with a = 1 and b = 5 we specify the subsequence 2, 1, 4, 3 that starts just after the first 1 and ends just before the first 5 after that 1.
Write a program that reads in a number of cases, each case specifying a section, and prints out the sections specified.
The input indicates, for each case, first a and b, followed by the length of the sequence n, all three in one line, separated by whitespace; the subsequent line (or lines) bring n integers constituting the sequence, and after them, in a separate line, may start a new case.
The sections indentified must be printed on one line each as in the
given examples. Pay attention to the spaces. After each case, print a
line with ten dashes: ----------.
For each case, the section identified can be empty; there are three such cases: (1) when a does not appear in the sequence, (2) when it appears but b does not appear subsequently, and (3) when both appear in the right order, but there are no intervening numbers. In these cases, your program must print appropriately nothing inside the corresponding line.
In problem X99803 sections are specified in the same way, although there are differences: the input is specified differently because each input brings in only one case, and a different processing is requested.
Input
1 5 12 6 0 1 2 1 4 3 5 4 3 5 1 7 5 12 6 0 1 2 1 4 3 5 4 3 5 1 5 7 12 6 0 1 2 1 4 3 5 4 3 5 1 2 1 12 6 0 1 2 1 4 3 5 4 3 5 1 6 7 12 6 8 1 2 1 4 3 5 4 3 5 7
Output
2 1 4 3 ---------- ---------- ---------- ---------- 8 1 2 1 4 3 5 4 3 5 ----------