This compiles fine and works well with no spaces, but once I put spaces in it either tells me its not a palindrome or times out. Any help would be greatly appreciated!
Maybe you should get rid of line 17, since you don't process what you extract from the input stream there. You're also accessing outside the bounds of the_string -- there is no effort made to make sure i doesn't equal or exceed the_string.length().