If someone doesn't know how to reverse words in a sentence they are absolutely not qualified to be a programmer. Yes they probably won't do this exact task often, but this is like a doctor that can't distinguish heart from the liver. It tells you something has gone horribly wrong.
What if the sentence is in Japanese (which doesn’t use spaces)?
In many languages, the basic version can be just one line of code, if you know the right libraries to leverage. C# leveraging Linq, for example: