#include <stdio.h>

main() {
    char str1[10], str2[10];
    int count1[26], count2[26];
    
    scanf("%s", str1);
    scanf("%s", str2);
    
    for (int i=0; i<26; i++) {
        count1[i] = count2[i] = 0;
    }
    
    for (int i=0; i<10; i++) {
        if (str1[i] == 0)
            break;
        count1[str1[i]-'a']++;
        count2[str2[i]-'a']++;
    }
    
    for (int i=0; i<26; i++) {
        if (count1[i] != count2[i]) {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    
}