Just so you know, even if you get this working, it will not conform to the spec. Basically, the path that you are going down is a subroutine that, when complete, will reverse a string of two words. For the more general solution, take a look at the built-in functions reverse and split. I think that they will help tremendously.
p.s. welcome to the fold