https://www.acmicpc.net/problem/1105
l,r=input().split() num=0 if len(l)==len(r): for i in range(len(l)): if l[i]==r[i] and l[i]=='8': num+=1 elif l[i] != r[i]: break print(num)