Skip to content · ⁨Saltar al contenido⁩

Reverse the word order · ⁨Invertir el orden de las palabras⁩

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.

Español

Invertir el orden de las palabras

Dada una oración con palabras separadas por espacios, devuelve las palabras en orden inverso: the quick brown → brown quick the. Separa las palabras usando s.split(" "), luego construye el resultado desde la última palabra hasta la primera. Un StringBuilder es la forma ordenada de unirlos.

Log in or create account · ⁨Iniciar sesión o crear cuenta⁩

IGCSE, A-Level & AP