#C13483. Reverse a List
Reverse a List
Reverse a List
You are given a list of integers. Your task is to reverse the list without using any built-in reverse functions.
More formally, if the input list is \(A = [a_1, a_2, \dots, a_n]\), you need to output \(A^\text{rev} = [a_n, a_{n-1}, \dots, a_1]\). Ensure your solution correctly handles edge cases such as empty lists and lists with a single element.
Input will be provided via standard input (stdin) and the result should be written to standard output (stdout). Use space-separated integers for input and output.
inputFormat
The first line of input contains a single integer \(n\) representing the number of elements in the list. If \(n > 0\), the second line contains \(n\) space-separated integers. If \(n = 0\), the second line may be empty.
outputFormat
Output a single line containing the \(n\) integers in reverse order, separated by a space.
## sample3
1 2 3
3 2 1