Q: what is the last character you typed for the sentence?
A: an ENTER

That ENTER is what getchar() gets.

Suggestion: use fgets() instead of scanf() to read the sentence.