5 lines
154 B
Python
5 lines
154 B
Python
def f(k):
|
|
a,b,c=*map(int,k[0].split('-')),k[1][0]
|
|
return (k[2][a-1]==c)^(k[2][b-1]==c)
|
|
print(sum(f(x.split()) for x in open("/dev/stdin").readlines()))
|