import 'dart:io';

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

  List ss = s.split("");
  List sortS = ss..sort();
  String stringS = sortS.join();
  List tt = t.split("");
  List sortT = tt..sort((b, a) => a.compareTo(b));
  String stringT = sortT.join();
  List before = [stringS, stringT];
  List after = before..sort();
  if (before != after) {
    print("No");
    return;
  } else {
    if (sortS.length - 1 < sortT.length - 1) {
      print("Yes");
      return;
    } else {
      print("No");
      return;
    }
  }
}