2015 day 8 part 2
This commit is contained in:
parent
8d52f62d14
commit
3dd9ea1f9f
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env python3
|
||||
import fileinput
|
||||
|
||||
|
||||
def compute(line):
|
||||
return (
|
||||
len(line),
|
||||
len(eval(line)),
|
||||
len(line.encode('unicode_escape').decode().replace('"', r'\"')) + 2,
|
||||
)
|
||||
|
||||
len_line, len_eval, len_encode = map(sum, zip(*map(compute, map(str.strip, fileinput.input()))))
|
||||
print(len_line - len_eval, len_encode - len_line)
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
import fileinput
|
||||
|
||||
|
||||
len1, len2 = map(sum, zip(*map(lambda x: (len(x), len(eval(x))), map(str.strip, fileinput.input()))))
|
||||
print(len1 - len2)
|
Loading…
Reference in New Issue