Count and total · Medium

Most common word

A customer review is given as one block of text.

Task

Write a prompt that finds the word used most often, and how many times.

Output format

<word>,<count>

  • Ignore capitals (The and the are the same word) and punctuation.
  • Give the word in lower case.
  • If several words tie, give the one first in alphabetical order.

Your prompt must contain {input}: it is replaced by each test case, just like the hidden tests in a hiring test.

Sample case 1
Input
The food was good and the service was good.
Output
good,2
Sample case 2
Input
Fast, fast, FAST delivery!
Output
fast,3

There are 5 test cases in all; the others are like hidden tests: work out what tricky inputs they might use!

Loading the editor…