#include <stdio.h>

int main() {
	char s[15],t[15];
    int count = 0;
	scanf("%s", s, 15);
	scanf("%s", t, 15);
	for (int i = 0; i < 10; i++) {
		if (s[i] == t[i]) count += 1;
	}
    if(count == 10) printf("Yes");
    else printf("No");
	return 0;
}