91juhwang / code_challenge_alphabetical_order

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Words with alphabet-consecutive letters

Question

Lets say a word has alphabet-consecutive letters if it contains two or more letters which are next to each other in the alphabet. For instance, the word 'task' contains 's' and 't'.

Write a program which can find the sentence in a paragraph which has the most words with alphabet-consecutive letters.

Test paragraphs

'This is a test paragraph. There are some words in it. Lots of words.'

'A test with only one sentence'

'A test with an ellipsis... Hard to deal with.'

'Two sentences with the same numbers of alphabet-consecutive words. Both sentences have five words which are consecutive and that is it'

'How do you deal with question marks? Surely you can deal with exclamation marks! My solution can, and it can also deal with commas.'

'Double-counting words with lots of consecutive characters. Like abcdefghijklmno.'

"Here is a longer paragraph. It has lots of sentences. Some of the sentences are short. Some have lots and lots and lots of consecutive words. Some of them are really long but have very few which fulfill the criteria in a correct way. This should be ok with your program."

About


Languages

Language:Ruby 100.0%