sample code to check whether a sentence is gramatically correct or not