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