Challenge: Find Repeating Words in a Sentence

Test the concepts we learned with a coding exercise.

Problem statement

For this challenge, you need to write a function that takes in a string and returns the repeating words in that string. The output should be a string containing the list of repeating words separated by a comma.

Sample input

A string like "The rain poured and poured, making the streets flood.".

Sample output

For the sample input above, the string "the,poured" would be the output. Casing can be ignored.

Coding challenge

You have been provided with some skeleton code and must complete the findRepeatingWords function. If you need some help, click the “Need Hint?” button.

Try to solve this yourself first. However, if you get stuck, you can click the “Show Solution” button to view the solution. For a detailed explanation, you can go to the next lesson. Good luck!

Get hands-on with 1200+ tech skills courses.