Skip to content

Instantly share code, notes, and snippets.

@heat
Created March 20, 2012 17:31
Show Gist options
  • Save heat/2138417 to your computer and use it in GitHub Desktop.
Save heat/2138417 to your computer and use it in GitHub Desktop.
Reverse word problem solve
#! /usr/bin/env python
import sys, re, os, string
f = open('problem.in')
cases = int(f.readline())
for case in range(1, cases + 1) :
phrase = f.readline().split()
phrase.reverse()
print "Case #%d: %s"%(case,
string.join(phrase, ' '))
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment