https://www.acmicpc.net/problem/1105
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
String l=s.next();
String r=s.next();
int num=0;
if(l.length()==r.length()){
for(int i=0;i<l.length();i++){
if(l.charAt(i)==r.charAt(i) && l.charAt(i)=='8'){
num++;
}
else if(l.charAt(i) != r.charAt(i)) break;
}
}
System.out.print(num);
}
}