import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        if (a.length() >= b.length()) {
            if (b.length() < 5) {
                if (a.length() == 1 && b.length() == 1) {
                    if (a.charAt(0) > b.charAt(0)) System.out.println("YES");
                    return;
                }
                int len = 1;
                for (int i = 1; i < a.length(); i++) {
                    if (a.charAt(i) <= b.charAt(0)) continue;
                    if (a.charAt(i) == a.charAt(i - 1)) len++;
                    else len = 1;
                    if (len == b.length()) {
                        System.out.println("YES");
                        return;
                    }
                }
            } else if (b.length() == 5) {
                char prev = b.charAt(0);
                int len = 0;
                for (int i = 1; i < a.length() - 4; i++) {
                    if (a.charAt(i) <= b.charAt(0)) continue;
                    if (a.charAt(i) == prev + 1) {
                        len++;
                        if (len == 5) {
                            System.out.println("YES");
                            return;
                        }
                    } else if (a.charAt(i) > prev + 1) len = 1;
                    prev = a.charAt(i);
                }
            }
        }
        System.out.println("NO");
    }
}