Hello there! Well, I can’t say anything about this problem other than it’s just super easy. Allow me to show you:
Given a list of space separated words, reverse the order of the words.
If that first sentence didn’t kill it for you, I don’t know what will. Anyway, the python code (validated, of course):
for case in range(1,int(raw_input())+1): # For all test cases words = raw_input().split(" ") # Get the list of words words.reverse() # Reverse word list print "Case #%d: %s" % (case, " ".join(words)) # Reports results, add spaces
Can’t get easier than that. And I actually had to learn that reverse() does not return the reversed list… in a perfect world, it could be solved within the print line, with:
" ".join(raw_input().split(" ").reverse())
But, maybe next time… 😀 See ya, warned you it was real quick!