Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Mode length of a sentence

The task is simple. You are given a string with alphabetical words (say "Hello world, this are tests"). You have to return the mode of the lengths of words in the string. In this case, output is 5, as it's the most often length of words in the string.

Definition of an alphabetical word (for this challenge): a string that consists of a-zA-Z only.

Sample I/O:

Constraints: Input has atleast one word, and a unique mode. Max. length is provided in last test case. Also, the string would be a single line, no newline chars.

(In = Out format)

"Hello world, this are tests"                     =  5
"Hello    world, this... are tests"               =  5
"I"                                               =  1
"Let's box (ง︡'-'︠)ง"                               =  3
"Writing some ✍(◔◡◔) program"                   =  7
"the-the-the-then"                                =  3
"Gooooooooogle is an app"                         =  2
"()<>a+/sentence$#@(@with::many---_symbols{}|~~"  =  4
"anot_her test actually"                          =  4

The unicode tests are optional.

1000 words string = 5 (Password: PXuCdMj5u65vwst)

This is a , so fewest bytes will win!

Answer*

Cancel