Print Digits in Both Directions
Submit solution
Points:
100
Time limit:
1.0s
Memory limit:
256M
Author:
Problem types
Allowed languages
Python
Given a non-negative integer \(n\), print its decimal digits from left to right and then from right to left.
Input
One line containing \(n\).
The input satisfies:
- \(0 \le n \le 10^18\)
Output
On the first line, print the digits from left to right. On the second line, print them from right to left. Separate adjacent digits by one space.
Example
Input
12030
Output
1 2 0 3 0
0 3 0 2 1
Explanation
The first line preserves 1,2,0,3,0; the second line prints that sequence in reverse.
Comments