Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import collections, string
- x = 0
- f = open('input.txt')
- key = string.ascii_lowercase
- def decrypt(n, ciphertext):
- result = ''
- for l in ciphertext:
- try:
- i = (key.index(l) + int(n)) % 26
- result += key[i]
- except ValueError:
- result += l
- return result
- for line in f.readlines():
- line = line.strip()
- l_array = line.replace('[','-').replace(']','').split('-')
- encroom = l_array[len(l_array)-1]
- sid = l_array[len(l_array)-2]
- room_name = ''.join(l_array[:len(l_array)-2])
- countz = collections.Counter(room_name)
- countz2 = list(sorted(countz.iteritems(),key=lambda(k,v):(-v,k)))
- if 'north' in decrypt(sid,room_name):
- print decrypt(sid,room_name),sid
- print x
- #print sorted(countz.iteritems(),key=lambda(k,v):(-v,k))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement