#include <stdio.h>
#include <limits.h>
#include <string.h>
int main() {
    char S[10], T[127];
    int i;

    scanf("%s", S);
    scanf("%s", T);
    for (i = 0; S[10] != '\0';++i){}

    switch (i%10) {
        case 1 :if(strncmp(S,T,1)==0)
                printf("Yes"); 
                else
                    printf("No");
                break;
        case 2 :if(strncmp(S,T,2)==0)
                printf("Yes"); 
                else
                    printf("No");
                break;
        case 3 :if(strncmp(S,T,3)==0)
                printf("Yes"); 
                else
                    printf("No");
                break;
        case 4 :if(strncmp(S,T,4)==0)
                printf("Yes"); 
                else
                    printf("No");
                break;
        case 5 :if(strncmp(S,T,5)==0)
                printf("Yes"); 
                else
                    printf("No");
                break;
        case 6 :if(strncmp(S,T,6)==0)
                printf("Yes"); 
                else
                    printf("No");
                break;
        case 7 :if(strncmp(S,T,7)==0)
                printf("Yes"); 
                else
                    printf("No");
                break;
        case 8 :if(strncmp(S,T,8)==0)
                printf("Yes"); 
                else
                    printf("No");
                break;
        case 9 :if(strncmp(S,T,9)==0)
                printf("Yes"); 
                else
                    printf("No");
                break;
        case 0 :if(strncmp(S,T,10)==0)
                printf("Yes"); 
                else
                    printf("No");
                break;
    }
    return 0;
}
