import java.util.Scanner;

public class Main {
    public static int distance(String s1, String s2, int i, int j) {
        if (j == s2.length()) {
            return s1.length() - i;
        }
        if (i == s1.length()) {
            return s2.length() - j;
        }
        if (s1.charAt(i) == s2.charAt(j)) {
            return distance(s1, s2, i + 1, j + 1);
        }
        int rep = distance(s1, s2, i + 1, j + 1) + 1;
        return rep;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int dist = distance(in.next(), in.next(), 0, 0);
        System.out.println(dist);

    }

} import java.util.Scanner; Scanner java.util public class Main {
    public static int distance(String s1, String s2, int i, int j) {
        if (j == s2.length()) {
            return s1.length() - i;
        }
        if (i == s1.length()) {
            return s2.length() - j;
        }
        if (s1.charAt(i) == s2.charAt(j)) {
            return distance(s1, s2, i + 1, j + 1);
        }
        int rep = distance(s1, s2, i + 1, j + 1) + 1;
        return rep;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int dist = distance(in.next(), in.next(), 0, 0);
        System.out.println(dist);

    }

} Main public static int distance(String s1, String s2, int i, int j) {
        if (j == s2.length()) {
            return s1.length() - i;
        }
        if (i == s1.length()) {
            return s2.length() - j;
        }
        if (s1.charAt(i) == s2.charAt(j)) {
            return distance(s1, s2, i + 1, j + 1);
        }
        int rep = distance(s1, s2, i + 1, j + 1) + 1;
        return rep;
    } distance {
        if (j == s2.length()) {
            return s1.length() - i;
        }
        if (i == s1.length()) {
            return s2.length() - j;
        }
        if (s1.charAt(i) == s2.charAt(j)) {
            return distance(s1, s2, i + 1, j + 1);
        }
        int rep = distance(s1, s2, i + 1, j + 1) + 1;
        return rep;
    } if (j == s2.length()) {
            return s1.length() - i;
        } j == s2.length() j s2.length() s2.length s2 {
            return s1.length() - i;
        } return s1.length() - i; s1.length() - i s1.length() s1.length s1 i if (i == s1.length()) {
            return s2.length() - j;
        } i == s1.length() i s1.length() s1.length s1 {
            return s2.length() - j;
        } return s2.length() - j; s2.length() - j s2.length() s2.length s2 j if (s1.charAt(i) == s2.charAt(j)) {
            return distance(s1, s2, i + 1, j + 1);
        } s1.charAt(i) == s2.charAt(j) s1.charAt(i) s1.charAt s1 i s2.charAt(j) s2.charAt s2 j {
            return distance(s1, s2, i + 1, j + 1);
        } return distance(s1, s2, i + 1, j + 1); distance(s1, s2, i + 1, j + 1) distance s1 s2 i + 1 i 1 j + 1 j 1 int rep = distance(s1, s2, i + 1, j + 1) + 1; rep distance(s1, s2, i + 1, j + 1) + 1 distance(s1, s2, i + 1, j + 1) distance s1 s2 i + 1 i 1 j + 1 j 1 1 return rep; rep String s1 s1 String s2 s2 int i i int j j public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int dist = distance(in.next(), in.next(), 0, 0);
        System.out.println(dist);

    } main {
        Scanner in = new Scanner(System.in);
        int dist = distance(in.next(), in.next(), 0, 0);
        System.out.println(dist);

    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int dist = distance(in.next(), in.next(), 0, 0); dist distance(in.next(), in.next(), 0, 0) distance in.next() in.next in in.next() in.next in 0 0 System.out.println(dist) System.out.println System.out System System.out dist String[] args args public class Main {
    public static int distance(String s1, String s2, int i, int j) {
        if (j == s2.length()) {
            return s1.length() - i;
        }
        if (i == s1.length()) {
            return s2.length() - j;
        }
        if (s1.charAt(i) == s2.charAt(j)) {
            return distance(s1, s2, i + 1, j + 1);
        }
        int rep = distance(s1, s2, i + 1, j + 1) + 1;
        return rep;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int dist = distance(in.next(), in.next(), 0, 0);
        System.out.println(dist);

    }

} public class Main {
    public static int distance(String s1, String s2, int i, int j) {
        if (j == s2.length()) {
            return s1.length() - i;
        }
        if (i == s1.length()) {
            return s2.length() - j;
        }
        if (s1.charAt(i) == s2.charAt(j)) {
            return distance(s1, s2, i + 1, j + 1);
        }
        int rep = distance(s1, s2, i + 1, j + 1) + 1;
        return rep;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int dist = distance(in.next(), in.next(), 0, 0);
        System.out.println(dist);

    }

} Main
import java.util.Scanner;

public class Main {
    public static int distance(String s1, String s2, int i, int j) {
        if (j == s2.length()) {
            return s1.length() - i;
        }
        if (i == s1.length()) {
            return s2.length() - j;
        }
        if (s1.charAt(i) == s2.charAt(j)) {
            return distance(s1, s2, i + 1, j + 1);
        }
        int rep = distance(s1, s2, i + 1, j + 1) + 1;
        return rep;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int dist = distance(in.next(), in.next(), 0, 0);
        System.out.println(dist);

    }

}