Current work
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
from collections import Counter
|
||||
|
||||
read = open("blocks.in")
|
||||
n = int(read.readline())
|
||||
blocksNeeded = [0] * 26
|
||||
|
||||
for _ in range(n):
|
||||
a, b = read.readline().split()
|
||||
a, b = Counter(a), Counter(b)
|
||||
for key in a:
|
||||
if key in b:
|
||||
blocksNeeded[ord(key) - ord("a")] += max(a[key], b[key])
|
||||
else:
|
||||
blocksNeeded[ord(key) - ord("a")] += a[key]
|
||||
|
||||
for key in b:
|
||||
if key in a:
|
||||
continue
|
||||
else:
|
||||
blocksNeeded[ord(key) - ord("a")] += b[key]
|
||||
|
||||
with open("blocks.out", "w") as out:
|
||||
for block in blocksNeeded:
|
||||
print(block, file=out)
|
||||
Reference in New Issue
Block a user