$10K coding deathmatch

Barry Roberts blr at robertsr.us
Thu Nov 2 11:04:02 MST 2006


This, I believe, is a correct Python implementation:

#!/usr/bin/python

import sys, string;

for currLine in sys.stdin:
    nums = map(int, string.split(string.strip(currLine), ' '))
    for ind in range(len(nums)-1):
        diff=abs(nums[ind]-nums[ind+1])
        if diff == 0 or diff >= len(nums):
            print "not a match"
            break
    else:
        print "match"





More information about the PLUG mailing list