Move zeroes
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Sequence of integers is given. Rearrange all 0's to the end of it while maintaining the relative order of non-zero elements.
Input
First line contains number of elements n (1 ≤ n ≤ 100) in the sequence. Second line contains n integers, not greater than 100 by absolute value.
Output
Print the sequence so that all its 0's are moved to the end, and the relative order of non-zero elements is not changed.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 12K
Acceptance rate 63%