import 'dart:io';

void main() {
  String s = stdin.readLineSync();
  String t = stdin.readLineSync();

  List ss = s.split("");
  List sortS = ss..sort();
  List tt = t.split("");
  List sortT = tt..sort();
  List st = [sortS.toString(), sortT.toString()];
  List sortST = st..sort();
  if (st[0] == sortST[0]) {
    print("Yes");
  }
}