#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main() {
    char s1[20], s2[20];
    scanf("%s", s1);
     scanf("%s", s2);
     if(strlen(s1) < 1 || strlen(s1) > 10 || strlen (s2) <1 || strlen (s2) >10) {
         printf("Invalid input");
         return 0;
     }
     for (int i = 0; s1[i]; i++)
     if (!isalpha(s1[i]))
     {
         printf("Invalid input");
         return 0;
     }
     for(int i = 0; s2[i]; i++)
     if(!isalpha(s2[i])){
         printf("Invalid input");
         return 0;
}
if(strlen(s1) !=strlen(s2) i++){
printf("NO");
return 0;
}
for(int i = 0; i < strlen(s1)-1; i++)
for(int j = 0; i+1; j < strlen(s1); j++) {
    if(s1[i] > s1[j]) { char 
    t=s1[i]; s1[i]=s1[j]; s1[j]=t;
    }
    if(s1[i] > s1[j] ) {
        t=s2[i]; s2[i]=s2[j]; s2[j]=t;
    }
}
if(strcmp(s1, s2) == 0)
printf("YES");
else printf("NO");
return 0;
}