import java.util.Scanner;

public class Main {

    private static boolean canBeAppended(String s1, String s2) {
        if (s1 == null || s2 == null) {
            return false;
        }

        int m = s1.length(), n = s2.length(), i = 0;
        while (i < m && i < n) {
            if (s1.charAt(i) != s2.charAt(i)) {
                return false;
            }
            i++;
        }

        return n != i && n - i <= 2;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();

        System.out.println(canBeAppended(s1, s2) ? "Yes" : "No");
        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {

    private static boolean canBeAppended(String s1, String s2) {
        if (s1 == null || s2 == null) {
            return false;
        }

        int m = s1.length(), n = s2.length(), i = 0;
        while (i < m && i < n) {
            if (s1.charAt(i) != s2.charAt(i)) {
                return false;
            }
            i++;
        }

        return n != i && n - i <= 2;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();

        System.out.println(canBeAppended(s1, s2) ? "Yes" : "No");
        sc.close();
    }
} Main private static boolean canBeAppended(String s1, String s2) {
        if (s1 == null || s2 == null) {
            return false;
        }

        int m = s1.length(), n = s2.length(), i = 0;
        while (i < m && i < n) {
            if (s1.charAt(i) != s2.charAt(i)) {
                return false;
            }
            i++;
        }

        return n != i && n - i <= 2;
    } canBeAppended {
        if (s1 == null || s2 == null) {
            return false;
        }

        int m = s1.length(), n = s2.length(), i = 0;
        while (i < m && i < n) {
            if (s1.charAt(i) != s2.charAt(i)) {
                return false;
            }
            i++;
        }

        return n != i && n - i <= 2;
    } if (s1 == null || s2 == null) {
            return false;
        } s1 == null || s2 == null s1 == null s1 null s2 == null s2 null {
            return false;
        } return false; false int m = s1.length() m s1.length() s1.length s1 n = s2.length() n s2.length() s2.length s2 i = 0; i 0 while (i < m && i < n) {
            if (s1.charAt(i) != s2.charAt(i)) {
                return false;
            }
            i++;
        } i < m && i < n i < m i m i < n i n {
            if (s1.charAt(i) != s2.charAt(i)) {
                return false;
            }
            i++;
        } if (s1.charAt(i) != s2.charAt(i)) {
                return false;
            } s1.charAt(i) != s2.charAt(i) s1.charAt(i) s1.charAt s1 i s2.charAt(i) s2.charAt s2 i {
                return false;
            } return false; false i++ i return n != i && n - i <= 2; n != i && n - i <= 2 n != i n i n - i <= 2 n - i n i 2 String s1 s1 String s2 s2 public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();

        System.out.println(canBeAppended(s1, s2) ? "Yes" : "No");
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();

        System.out.println(canBeAppended(s1, s2) ? "Yes" : "No");
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s1 = sc.next(); s1 sc.next() sc.next sc String s2 = sc.next(); s2 sc.next() sc.next sc System.out.println(canBeAppended(s1, s2) ? "Yes" : "No") System.out.println System.out System System.out canBeAppended(s1, s2) ? "Yes" : "No" canBeAppended(s1, s2) canBeAppended s1 s2 "Yes" "No" sc.close() sc.close sc String[] args args public class Main {

    private static boolean canBeAppended(String s1, String s2) {
        if (s1 == null || s2 == null) {
            return false;
        }

        int m = s1.length(), n = s2.length(), i = 0;
        while (i < m && i < n) {
            if (s1.charAt(i) != s2.charAt(i)) {
                return false;
            }
            i++;
        }

        return n != i && n - i <= 2;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();

        System.out.println(canBeAppended(s1, s2) ? "Yes" : "No");
        sc.close();
    }
} public class Main {

    private static boolean canBeAppended(String s1, String s2) {
        if (s1 == null || s2 == null) {
            return false;
        }

        int m = s1.length(), n = s2.length(), i = 0;
        while (i < m && i < n) {
            if (s1.charAt(i) != s2.charAt(i)) {
                return false;
            }
            i++;
        }

        return n != i && n - i <= 2;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();

        System.out.println(canBeAppended(s1, s2) ? "Yes" : "No");
        sc.close();
    }
} Main
import java.util.Scanner;

public class Main {

    private static boolean canBeAppended(String s1, String s2) {
        if (s1 == null || s2 == null) {
            return false;
        }

        int m = s1.length(), n = s2.length(), i = 0;
        while (i < m && i < n) {
            if (s1.charAt(i) != s2.charAt(i)) {
                return false;
            }
            i++;
        }

        return n != i && n - i <= 2;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();

        System.out.println(canBeAppended(s1, s2) ? "Yes" : "No");
        sc.close();
    }
}