// editor2
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int isAlphabetic(char str[])
{
    for(int i=0;str[i]!='\0';i++)
    {
        if(isalpha(str[i]))
        {
            return 0;
        }
    }
    return 0;
}
int main()
{
    char str1[20],str[20];
    int count1[26]={0},count2[26]={0};
    scanf("%s",str1);
    scanf("%s",str2);
    if(strlen(str1)>10||strlen(str2)>10)
    {
        printf("Invalid input");
        return 0;
    }
    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']++;
    for(int i=0;str2[i]!='\0';i++)
    count2[tolower(str2[i])-'a']++;
    for(int i=0;i<26;i++)
    {
        if(count1[i] !=count2[i])
        {
            printf("NO");
        }
    }
    printf("Yes");
    return 0;
}