print((sum(i==j for i,j in zip(*open(0)))-1))
print((3-sum(i!=j for i,j in zip(*open(0)))))
print((sum(i == j for i, j in zip(*open(0))) - 1))

print((3 - sum(i != j for i, j in zip(*open(0)))))

-print((sum(i == j for i, j in zip(*open(0))) - 1)) +print((3 - sum(i != j for i, j in zip(*open(0)))))