Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Finding the Longest Word | String Advanced
Java Extended
course content

Contenido del Curso

Java Extended

Java Extended

1. Deep Java Structure
2. Methods
3. String Advanced
4. Classes
5. Classes Advanced

bookChallenge: Finding the Longest Word

Tarea

Write a program that finds the longest word in a string and outputs it along with the index of its first occurrence.

  1. The program should split the string into words and check the length of each word.
  2. For each word, compare its length with the length of the current longest word.
  3. If the current word is longer than the longest one, update the longest word and its index.
  4. Finally, output the result in the format: "Longest word: [word] at index [index]", where [word] is the longest word and [index] is the index of its first occurrence in the string.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 5
toggle bottom row

bookChallenge: Finding the Longest Word

Tarea

Write a program that finds the longest word in a string and outputs it along with the index of its first occurrence.

  1. The program should split the string into words and check the length of each word.
  2. For each word, compare its length with the length of the current longest word.
  3. If the current word is longer than the longest one, update the longest word and its index.
  4. Finally, output the result in the format: "Longest word: [word] at index [index]", where [word] is the longest word and [index] is the index of its first occurrence in the string.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 5
toggle bottom row

bookChallenge: Finding the Longest Word

Tarea

Write a program that finds the longest word in a string and outputs it along with the index of its first occurrence.

  1. The program should split the string into words and check the length of each word.
  2. For each word, compare its length with the length of the current longest word.
  3. If the current word is longer than the longest one, update the longest word and its index.
  4. Finally, output the result in the format: "Longest word: [word] at index [index]", where [word] is the longest word and [index] is the index of its first occurrence in the string.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Tarea

Write a program that finds the longest word in a string and outputs it along with the index of its first occurrence.

  1. The program should split the string into words and check the length of each word.
  2. For each word, compare its length with the length of the current longest word.
  3. If the current word is longer than the longest one, update the longest word and its index.
  4. Finally, output the result in the format: "Longest word: [word] at index [index]", where [word] is the longest word and [index] is the index of its first occurrence in the string.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 3. Capítulo 5
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
some-alt