Skip to content · ⁨Passer au contenu⁩

Reverse the word order · ⁨Inverser l'ordre des mots⁩

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.

Français

Inverser l'ordre des mots

Étant donné une phrase de mots séparés par des espaces, retournez les mots dans l'ordre inverse : the quick brown → brown quick the. Séparez sur les espaces avec s.split(" "), puis construisez le résultat du dernier mot au premier. Un StringBuilder est la façon propre de les joindre.

Log in or create account · ⁨Se connecter ou créer un compte⁩

IGCSE, A-Level & AP