#K11576. Reverse Array

    ID: 23499 Type: Default 1000ms 256MiB

Reverse Array

Reverse Array

Given an array of integers, your task is to reverse the order of the elements. In other words, if the array is \(A = [a_1, a_2, \dots, a_n]\), you should output the array \(A' = [a_n, a_{n-1}, \dots, a_1]\). The program should read from standard input and write the reversed array to standard output.

inputFormat

The input consists of two lines. The first line contains a single integer (n) representing the number of elements in the array. The second line contains (n) space-separated integers.

outputFormat

Output the reversed array in a single line, with each element separated by a single space. If the array is empty, output an empty line.## sample

4
1 2 3 4
4 3 2 1

</p>