#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main(){
    char s1;
    char s2;
    scanf("%s",s1[20]);
    scanf("%s",s2[20]);
    for (int i=0;s1[i] !='\0';i++){
        if(!isalpha(s1[i])) {
            printf("Invalid input\n");
            return 0;
        }
    }
    for (int i=0;s2[i] !='\0';i++){
        if(!isalpha(s2[i])) {
            printf("Invalid input\n");
            return 0;
        }
    }

    for(int i=0;s1 [i] 1='\0';i++){
        tolower(s1 [i]);
        count[(s1 [i]);-'a']++;
    }
    for(int i=0;s2[i] 1='\0';i++){
        tolower(s2[i]);
        int count[(s2[i]);-'a']--;
    }
    for(int i=0;i<26;i++){
        if(count[i]!=0){
            printf("YES\n");
            return 0;
        }
    }
}
    
}
    
    
}