Hide

Problem C
Duplicate Removal

The company Al’s Chocolate Mangos has a website where visitors can guess how many chocolate-covered mangos are in a virtual jar. Visitors type in a guess between 1 and 99 and then click on a Submit button. Unfortunately, the response time from the server is often long, and visitors get impatient and click Submit several times in a row. This generates many duplicate requests.

Your task is to write a program to assist the staff at ACM in filtering out these duplicate requests.

Input

The input consists of a series of lines, one for each web session. The first integer on a line is $N$, $0 < N \leq 25$, which is the number of guesses on this line. These guesses are all between 1 and 99, inclusive. The value $N = 0$ indicates the end of all the input.

Output

For each input data set, output a single line with the guesses in the original order, but with consecutive duplicates removed. Conclude each output line with the dollar sign character $. Note that there is a single space between the last integer and the dollar sign.

Sample Input 1 Sample Output 1
5 1 22 22 22 3
0
1 22 3 $
Sample Input 2 Sample Output 2
4 98 76 20 76
0
98 76 20 76 $
Sample Input 3 Sample Output 3
6 19 19 35 86 86 86
0
19 35 86 $
Sample Input 4 Sample Output 4
1 7
0
7 $

Please log in to submit a solution to this problem

Log in