Skip to main content
Grammar
Source Link
Jordan
  • 11.3k
  • 1
  • 33
  • 55

Given a sentence, your program must make it'sits way through it, counting the frequencies of each word, then output the most used word. Because a sentence has no fixed length, and so can get very long, your code must be as short as possible.

Given a sentence, your program must make it's way through it, counting the frequencies of each word, then output the most used word. Because a sentence has no fixed length, and so can get very long, your code must be as short as possible.

Given a sentence, your program must make its way through it, counting the frequencies of each word, then output the most used word. Because a sentence has no fixed length, and so can get very long, your code must be as short as possible.

added another test case
Source Link
user53406
user53406
The man walked down the road.
==> the

-----

Slowly, he ate the pie, savoring each delicious bite. He felt like he was truly happy.
==> he

-----

This sentence has no most frequent word.
==> 

-----

"That's... that's... that is just terrible!" he said.
==> that's / thats

-----

The old-fashioned man ate an old-fashioned cake.
==> old-fashioned

-----

IPv6 looks great, much better than IPv4, except for the fact that IPv6 has longer addresses.
==> IPv6 

-----

This sentence with words has at most two equal most frequent words.
==>

Note: The third and seventh test case hascases have no output, you may choose either on the fourth.

The man walked down the road.
==> the

-----

Slowly, he ate the pie, savoring each delicious bite. He felt like he was truly happy.
==> he

-----

This sentence has no most frequent word.
==> 

-----

"That's... that's... that is just terrible!" he said.
==> that's / thats

-----

The old-fashioned man ate an old-fashioned cake.
==> old-fashioned

-----

IPv6 looks great, much better than IPv4, except for the fact that IPv6 has longer addresses.
==> IPv6

Note: The third test case has no output, you may choose either on the fourth.

The man walked down the road.
==> the

-----

Slowly, he ate the pie, savoring each delicious bite. He felt like he was truly happy.
==> he

-----

This sentence has no most frequent word.
==> 

-----

"That's... that's... that is just terrible!" he said.
==> that's / thats

-----

The old-fashioned man ate an old-fashioned cake.
==> old-fashioned

-----

IPv6 looks great, much better than IPv4, except for the fact that IPv6 has longer addresses.
==> IPv6 

-----

This sentence with words has at most two equal most frequent words.
==>

Note: The third and seventh test cases have no output, you may choose either on the fourth.

edited tags
Link
DJMcMayhem
  • 59.6k
  • 17
  • 196
  • 348
updated fourth test case
Source Link
user53406
user53406
Loading
Post Reopened by user53406, Bassdrop Cumberwubwubwub, Adnan, NoOneIsHere, DJMcMayhem
added better definition of a word, made apostrophes optional
Source Link
user53406
user53406
Loading
updated with new definition of a 'word'
Source Link
user53406
user53406
Loading
Post Closed as "Needs details or clarity" by Downgoat, user45941, ericw31415, DJMcMayhem, cat
Mod Moved Comments To Chat
updated to clarify apostrophe rule
Source Link
user53406
user53406
Loading
Fix snippet
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 37
  • 66
Loading
added more test cases
Source Link
user53406
user53406
Loading
clarified definition of a 'word' (thanks @LuisMendo)
Source Link
user53406
user53406
Loading
updated to clarify
Source Link
user53406
user53406
Loading
added another testcase
Source Link
user53406
user53406
Loading
Tweeted twitter.com/StackCodeGolf/status/729306597055471616
edited body
Source Link
cat
  • 5.9k
  • 2
  • 26
  • 44
Loading
Source Link
user53406
user53406
Loading