#split 7 from sys import stdin the_str = "" while(True): \x09new_char = stdin.read(1) \x09if new_char == '' and test_candidate == '': \x09\x09break \x09test_candidate = the_str + new_char \x09if int(test_candidate) % 7: \x09\x09#print test_candidate, "is a multiple of 7 continuing" \x09\x09the_str = test_candidate \x09else: \x09\x09#print "adding", new_char, "didnt work, printing previous candidate" \x09\x09print test_candidate \x09\x09the_str = ''
Note that non-ascii characters in the above source code will be escaped (such as \x9f).