#K6121. Recursive List Reversal
Recursive List Reversal
Recursive List Reversal
You are given a list of integers. Your task is to reverse the list using a recursive function without using any looping constructs or built‐in reverse functions. The reversal must be implemented using recursion only.
Example:
Input: 1 2 3 4 5 Output: 5 4 3 2 1
If the input list is empty, simply output an empty line.
Note: The input will be provided as a single line where the integers are separated by spaces, and the output should also be the reversed list as a space‐separated list printed on one line.
inputFormat
The input consists of a single line containing zero or more integers separated by spaces.
outputFormat
Output the reversed list as a single line of space-separated integers. If the list is empty, output an empty line.
## sample1 2 3 4 5
5 4 3 2 1