aoc2017day04-2

Run Settings
LanguagePython
Language Version
Run Command
import sys def compare(x,y): return str(sorted(list(x))) == str(sorted(list(y))) def doit(input): phrases = list(input.strip().split("\n")) sum = 0 for p in phrases: words = p.split() invalid = 0 for i in range(len(words)): for j in range(len(words)): if j <= i: continue if compare(words[i], words[j]): invalid += 1 if invalid == 0: sum += 1 return "%d" % sum input = sys.stdin.read() print(doit(input))
Editor Settings
Theme
Key bindings
Full width
Lines