Reversing a list of words (1) P26041


Statement
 

pdf   zip

thehtml

Write a program that reads a sequence of words and prints it in reverse order.

Input

Input consists of a sequence of words.

Output

Print the 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

    jordi
    mireia
    arnau
    

    Output

    arnau
    mireia
    jordi
    
  • Input

    dolphins
    octopuses
    squid
    sharks
    whales
    piranhas
    killerwhales
    

    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 Python