
Problem: Reverse "the house is blue", the answer should be "blue is house the". the words are reversed, but the letters are still in order (within the word).
Solution:
The solution can be attained by first reversing the string normally, and then just reversing each word.
initial: the house is blue
reverse: eulb si esuoh eht
Now reverse the word at its place
initial: the house is blue
reverse: eulb si esuoh eht
wanted : blue is house the
0 comments:
Post a Comment