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 code-golf, so fewest bytes will win!