Reversing the order

If you navigate to the SUBMISSIONS tab at the top of the page, you’ll see that the submissions are ordered from the most recent to the least recent. Imagine you want to develop that feature for 4 submissions. You get the names of people who have submitted their solutions in chronological order. Now you need to write a program that gets those names in the input and prints them in reverse chronological order (most recent first).
 
Here is an example of the program execution:
Input
Output
David Martin Edward Martin
Martin Edward Martin David
Simon Sally Lily Bob
Bob Lily Sally Simon
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue