Print an Array in Both Directions
Submit solution
Points:
100
Time limit:
1.0s
Memory limit:
256M
Author:
Problem types
Allowed languages
Python
Given an array \(A\) of \(N\) integers, print it in its original order and then in reverse order.
Input
The first line contains \(N\). The second line contains \(N\) integers \(A_i\).
The input satisfies:
- \(1 \le N \le 10^5\)
- \(|A_i| \le 10^9\)
Output
Print A from left to right on the first line and from right to left on the second line. Separate adjacent values by one space.
Example
Input
5
1 2 3 4 5
Output
1 2 3 4 5
5 4 3 2 1
Comments