#include<stdio.h>
int main(void){
  char *s="python3 -c \""
"s,t=[0]*26,[0]*26\n"
"for a,b in zip(input(),input()):\n"
"  s[ord(a)-ord('a')]+=1\n"
"  t[ord(b)-ord('a')]+=1\n"
"u,v=[],[]\n"
"for a,b in zip(s,t):\n"
"  if a!=b:\n"
"    u.append(a)\n"
"    v.append(b)\n"
"print('YNeos'[sorted(u)!=sorted(v)::2])\n"
"\"";
  system(s);
  return 0;
}