fork download
  1. def parse(inFile):
  2. return inFile.readline()
  3.  
  4. def solve(text):
  5. N = len(text)
  6. x = [1 if c == "w" else 0 for c in text]
  7. for c in "elcome to code jam":
  8. x = [0] + [(sum(x[:i]) % 10000) if text[i] == c else 0 for i in xrange(1, N)]
  9. return "%04d" % (sum(x) % 10000)
  10.  
  11. if __name__ == "__main__":
  12. from GCJ import GCJ
  13. GCJ(parse, solve, "/Users/lpebody/gcj/2009_q/", "c").run()
  14.  
Runtime error #stdin #stdout 0.02s 4672KB
stdin
Standard input is empty
stdout
Standard output is empty