2nd version, take single line input but take care of last punctuation