Ruby program to check a given sentence for a given set of simple grammer rules. A simple sentence if syntactically correct if it fulfills given rules. The following are given rules.
- Sentence must start with a Uppercase character (e.g. Noun/ I/ We/ He / She / etc.)
- Then lowercase character follows.
- There must be spaces between words.
- Then the sentence must end with a full stop(.) after a word.
- Two continuous spaces are not allowed.
- Two continuous upper case characters are not allowed.
- However the sentence can end after an upper case character.
Example input and output
Please enter a sentence to check grammer mistake
welcome to DEMO for checking grammer mistake
Given sentence is wrong because
First character should start with upper case
Two spaces are not allowed
Two Uppercase characters are not allowed continuously
Sentence should end with full stop
Please enter a sentence to check grammer mistake
Welcome to demo for checking Grammer mistakE.
Given sentence is correct, sentence does not have grammer mistake