19 lines
431 B
Python
19 lines
431 B
Python
import sys
|
|
from collections import defaultdict as DD
|
|
|
|
D = DD(set)
|
|
for i in sys.stdin.read().strip().split('\n'):
|
|
a, b = i.split("-")
|
|
D[a].add(b)
|
|
D[b].add(a)
|
|
|
|
ans = 0
|
|
for (a,B) in D.items():
|
|
for b in B:
|
|
for c in D[b]:
|
|
for d in D[c]:
|
|
if d == a and a!=b and b!=c and c!=a and (a.startswith("t") or b.startswith("t")or c.startswith("t")):
|
|
ans += 1
|
|
print(ans//6)
|
|
|