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