Skip to content

Reverse the word order · ⁨反转单词顺序⁩

English

Reverse the word order

Given a sentence of space-separated words, return the words in reverse order: the quick brown → brown quick the. Split on spaces with s.split(" "), then build the result from the last word to the first. A StringBuilder is the tidy way to join them.

中文

反转单词顺序

给定一个由空格分隔的句子,按相反顺序返回这些单词:the quick brown → brown quick the。用 s.split(" ") 按空格拆分,然后从最后一个单词到第一个构建结果。用 StringBuilder 来拼接最为整洁。

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩