#include <stdio.h>
#include <stdio.h>
#include <ctype.h>
int main(){
    char str1[11], str2[11];
    int count1[26] = {0}, count2[26] = {0};
    int i, valid = 1;
    
    scanf("%s", str1);
    scanf("%s", str2);
    
    if (strlen(str1)<1 || strlen(str1)>10 || strlen(str2)<1 || strlen(str2)>10){
        printf("invalid input");
        return 0;
    }
    for (i = 0; str1[i] != '\0'; i++){
        if (!isalpha(str2[i])){
            valid = 0;
            break;
        }
    }
    
    if (!valid) {
        printf("invalid input");
        return 0;
    }
    
    for(i=0; str2[i] != '\0'; i++){
        count2[tolower(str2[i])-'a']++;
    }
    
    for(i=0; i<26; i++){
        if(count1[i] != count2[i]){
            printf("NO");
        }
    }
    printf("YES");
    return 0;
    
}