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