You are using the space as a deliminator, meaning you are breaking the words apart with a space. In the sentence "The input is" you get the space before is, then retrieve the word "is", you then get the space before input, and retrieve "is input" but there is no space before the word "The".
The letter 'T' of the word "The" resides in sentence[0]. Currently as written, line 12 will not execute when i = 0. You'll need to change that to
for(int i=length-1; i>=0; i--) Your length value will be 12, so you will only need to reference sentence[11] through sentence[0]. Once you include the location sentence[0] in your for loop, you will need to check for that special condition, namly when i = 0. You can do that in your if statement in line 14. If i equals 0, then that is your first word of the sentence.