#K8621. Reverse Spell Order

    ID: 36814 Type: Default 1000ms 256MiB

Reverse Spell Order

Reverse Spell Order

Given a string that contains one or more spell names separated by spaces, your task is to reverse the order of these spell names and output them as a single space‐separated line.

The challenge is simple: split the input string into individual spells, reverse their order, and print them out. The input is guaranteed to contain at least one spell name. This problem tests your understanding of string manipulation and basic array operations.

Mathematical Formulation:

If the input string is represented as \( S = s_1\ s_2\ \cdots\ s_n \), you must output \( s_n\ s_{n-1}\ \cdots\ s_1 \).

inputFormat

The input is read from standard input (stdin) and consists of a single line containing the spell names separated by spaces. There is at least one spell in the input.

outputFormat

Print to standard output (stdout) a single line containing the spell names in reversed order, separated by a single space.

## sample
lightning fireball frost nova
nova frost fireball lightning