34 lines
517 B
Python
Executable File
34 lines
517 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
def read_input():
|
|
with open('input.txt', 'r') as f:
|
|
for line in f:
|
|
yield line
|
|
|
|
|
|
def get_count(box):
|
|
occ2 = 0
|
|
occ3 = 0
|
|
|
|
seen = dict()
|
|
for c in set(box):
|
|
if occ2 and occ3:
|
|
break
|
|
if box.count(c) == 2:
|
|
occ2 = 1
|
|
if box.count(c) == 3:
|
|
occ3 = 1
|
|
return (occ2,occ3)
|
|
|
|
|
|
res2 = 0
|
|
res3 = 0
|
|
|
|
for box in read_input():
|
|
(tmp2, tmp3) = get_count(box)
|
|
res2 += tmp2
|
|
res3 += tmp3
|
|
|
|
|
|
print(res2*res3)
|