7 lines
410 B
Python
7 lines
410 B
Python
|
from functools import reduce
|
||
|
from math import floor, ceil
|
||
|
shuffle = lambda l, h, s: reduce(lambda a, b: (a[0], floor((a[0]+a[1])/2)) if b in "FL" else (ceil((a[0]+a[1])/2), a[1]), s, (l, h))[0]
|
||
|
lines = [l for l in open("input", "r").read().split("\n") if l]
|
||
|
ids = sorted([shuffle(0, 127, l[:7]) * 8 + shuffle(0, 7, l[7:]) for l in lines])
|
||
|
print([int((a+b)/2) for (a, b) in zip(ids, ids[1:]) if b - a == 2][0])
|