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 & AP