ENG  RUSTimus Online Judge
Online Judge
Online contests
About Online Judge
Frequently asked questions
Site news
Problem set
Submit solution
Judge status
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests

USU Junior Contest, October 2007

About     Problems     Submit solution     Judge status     Standings
Contest is over

J. Teamwork

Time limit: 1.0 second
Memory limit: 64 MB
Vasya and Petya are going to participate in a team olympiad in informatics. They have listened to the stories told by the gurus of olympiad programming and now they are aware that teamwork is of crucial importance for outstanding performance. Therefore they decided to develop their teamwork skills.
Vasya wrote a sequence of integers on a sheet of paper and started to read it to Petya number by number. For the sake of brevity he tells it in the following way: first he tells the quantity of consecutive identical numbers and then tells this number. For instance, the sequence “1 1 2 3 3 3 10 10” will be told by Vasya as “two ones, one two, three threes, two tens”. Petya also wants to be concise, so he writes down the numbers pronounced by Vasya instead of the whole words. For the example above, Petya would write: “2 1 1 2 3 3 2 10”.
After some teamwork practice, Vasya and Petya also decided to develop programming skills and to write a computer program to convert Vasya's sequence to Petya's one.


The first line contains an integer N, which is the quantity of numbers written down by Vasya (1 ≤ N ≤ 1000). The second line contains these numbers separated by spaces. All the numbers are positive integers not greater than 10.


Output the numbers Petya would write down separated by space.


1 1 2 3 3 3 10 10
2 1 1 2 3 3 2 10
Problem Author: Alex Samsonov
Problem Source: USU Junior Contest, October 2007
To submit the solution for this problem go to the Problem set: 1581. Teamwork