Reversing a list of words (3) P92998


Statement
 

pdf   zip

Write a program that reads a number nn and a sequence of nn or more words, and prints the first nn words reversed.

Input

Input begins with a natural number nn, followed by, at least, nn words.

Output

Print the first nn words of the original sequence, in reverse order, and one per line.

Observation

For the sake of practice, use recursion (not arrays).

Public test cases
  • Input

    3
    jordi
    mireia
    arnau
    

    Output

    arnau
    mireia
    jordi
    
  • Input

    7
    dolphins
    octopuses
    squid
    sharks
    whales
    piranhas
    killerwhales
    fish
    

    Output

    killerwhales
    piranhas
    whales
    sharks
    squid
    octopuses
    dolphins
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Haskell Perl Python