Buscador de frases II

Crie uma função que retorne a frase que contém a palavra no índice n. Lembre-se de incluir o ponto final.

Exemplo resolvido

final String txt = "I love Tesh. My world evolves in hers. My love for life.";

sentenceSearcher(txt, 4) ➞ "My world evolves in hers."
// The word at index 4 is "world".
// The full sentence that contains the word at index 4 is "My world evolves in hers."

Exemplos

sentenceSearcher(txt, 2) ➞ "I love Tesh."

sentenceSearcher(txt, 5) ➞ "My world evolves in hers."

sentenceSearcher(txt, -1) ➞ "My love for life."
// The index at -1 is the last word.
// The last word is "life".

Notas

  • Todas as frases terminarão com um ponto final.
  • Você também precisa considerar índices negativos.