change the code into trimSentence