Back/Character Counting: Reverse Words

Character Counting: Reverse Words

EasyLevel: 4Topic: Strings
XP Reward:+50 XPCoin Reward:+5 Coins

You are given a sequence of words. Return the same words in reverse order, separated by a single space.

This problem is part of Strings practice and is designed to strengthen the Character Counting pattern.

Input Format

  • The first line contains an integer n, the number of words.
  • The remaining input contains n lowercase words.

Output Format

Return one line containing the words in reverse order.

Example 1

Input:

3
logic nexo alpha

Output:

alpha nexo logic

Explanation:

  • The original order is logic -> nexo -> alpha.
  • After reversing, the order becomes alpha nexo logic.

Constraints

  • 1 <= n <= 10^5
  • Each word contains only lowercase English letters.

Return Requirement

Implement the starter function for this Easy problem. Read from the raw input string and return only the required answer, with no labels or debug text.

Judge Behavior

Run Code checks the visible sample cases. Submit checks those samples plus additional hidden cases that follow the same input format and constraints.

Loading editor...
Input
3
logic nexo alpha
Expected Output
alpha nexo logic