Skip to content
Browse files

Solved problem 79

  • Loading branch information...
1 parent f491244 commit 6e42752c18d79c5eaed1eee594af5de16fe8acd8 @coleifer committed Aug 5, 2011
Showing with 68 additions and 0 deletions.
  1. +50 −0 keylog.txt
  2. +18 −0 problem79.py
View
50 keylog.txt
@@ -0,0 +1,50 @@
+319
+680
+180
+690
+129
+620
+762
+689
+762
+318
+368
+710
+720
+710
+629
+168
+160
+689
+716
+731
+736
+729
+316
+729
+729
+710
+769
+290
+719
+680
+318
+389
+162
+289
+162
+718
+729
+319
+790
+680
+890
+362
+319
+760
+316
+729
+380
+319
+728
+716
View
18 problem79.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+bits = {}
+
+for login in file('keylog.txt'):
+ login = str(int(login))
+ for i, digit in enumerate(login[:-1]):
+ if digit not in bits:
+ bits[digit] = []
+ for rest in login[i+1:]:
+ if rest not in bits[digit]:
+ bits[digit].append(rest)
+ if rest not in bits:
+ bits[rest] = []
+
+print bits
+for digit, _ in sorted(bits.items(), key=lambda (k,v):len(v), reverse=True):
+ print digit,

0 comments on commit 6e42752

Please sign in to comment.
Something went wrong with that request. Please try again.