#C14291. Reverse a List
Reverse a List
Reverse a List
Given a list of elements, your task is to output the list in reversed order. More formally, if the input list is \(L = [a_1, a_2, \ldots, a_n]\), then the output should be \([a_n, a_{n-1}, \ldots, a_1]\).
The list elements can be integers or strings. Ensure that the order is correctly reversed even for edge cases such as empty lists or single-element lists.
inputFormat
The input consists of two lines. The first line contains a single integer \(n\) (\(0 \le n \le 10^5\)) representing the number of elements in the list. The second line contains \(n\) space-separated tokens representing the elements of the list. If \(n\) is 0, the second line will be empty.
outputFormat
Output a single line containing the \(n\) tokens in reverse order, separated by spaces. If the list is empty, output an empty line.
## sample5
1 2 3 4 5
5 4 3 2 1