Practice · 5 of 5
indexOf, twice
CHALLENGE
Difficulty: intermediate+25 XP
Implement boolean occursOnce(String text, String word): true when word appears in text exactly once. Use indexOf twice — the second call needs the start index form.
Press Submit to check your solution.
Back to lesson: Practice: String lab