import java.util.Scanner;

public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);

                String S = scan.next();
                String T = scan.next();

                int output = T.length();

                for (int i = 0; i <= S.length() - T.length(); i++) {
                	String tempS = S.substring(i,i+T.length());
                	int tempCount = 0;
                	for (int k = 0; k < T.length(); k++) {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	}
                	if (tempCount < output) {
                		output = tempCount;
                	}

                }

                System.out.println(output);

                scan.close();

        }

} import java.util.Scanner; Scanner java.util public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);

                String S = scan.next();
                String T = scan.next();

                int output = T.length();

                for (int i = 0; i <= S.length() - T.length(); i++) {
                	String tempS = S.substring(i,i+T.length());
                	int tempCount = 0;
                	for (int k = 0; k < T.length(); k++) {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	}
                	if (tempCount < output) {
                		output = tempCount;
                	}

                }

                System.out.println(output);

                scan.close();

        }

} Main public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);

                String S = scan.next();
                String T = scan.next();

                int output = T.length();

                for (int i = 0; i <= S.length() - T.length(); i++) {
                	String tempS = S.substring(i,i+T.length());
                	int tempCount = 0;
                	for (int k = 0; k < T.length(); k++) {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	}
                	if (tempCount < output) {
                		output = tempCount;
                	}

                }

                System.out.println(output);

                scan.close();

        } main {
                Scanner scan = new Scanner(System.in);

                String S = scan.next();
                String T = scan.next();

                int output = T.length();

                for (int i = 0; i <= S.length() - T.length(); i++) {
                	String tempS = S.substring(i,i+T.length());
                	int tempCount = 0;
                	for (int k = 0; k < T.length(); k++) {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	}
                	if (tempCount < output) {
                		output = tempCount;
                	}

                }

                System.out.println(output);

                scan.close();

        } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan String T = scan.next(); T scan.next() scan.next scan int output = T.length(); output T.length() T.length T for (int i = 0; i <= S.length() - T.length(); i++) {
                	String tempS = S.substring(i,i+T.length());
                	int tempCount = 0;
                	for (int k = 0; k < T.length(); k++) {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	}
                	if (tempCount < output) {
                		output = tempCount;
                	}

                } int i = 0; int i = 0; i 0 i <= S.length() - T.length() i S.length() - T.length() S.length() S.length S T.length() T.length T i++ i++ i {
                	String tempS = S.substring(i,i+T.length());
                	int tempCount = 0;
                	for (int k = 0; k < T.length(); k++) {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	}
                	if (tempCount < output) {
                		output = tempCount;
                	}

                } {
                	String tempS = S.substring(i,i+T.length());
                	int tempCount = 0;
                	for (int k = 0; k < T.length(); k++) {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	}
                	if (tempCount < output) {
                		output = tempCount;
                	}

                } String tempS = S.substring(i,i+T.length()); tempS S.substring(i,i+T.length()) S.substring S i i+T.length() i T.length() T.length T int tempCount = 0; tempCount 0 for (int k = 0; k < T.length(); k++) {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	} int k = 0; int k = 0; k 0 k < T.length() k T.length() T.length T k++ k++ k {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	} {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	} if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		} !tempS.substring(k,k+1).equals(T.substring(k,k+1)) tempS.substring(k,k+1).equals(T.substring(k,k+1)) tempS.substring(k,k+1).equals tempS.substring(k,k+1) tempS.substring tempS k k+1 k 1 T.substring(k,k+1) T.substring T k k+1 k 1 {
                			tempCount++;
                		} tempCount++ tempCount if (tempCount < output) {
                		output = tempCount;
                	} tempCount < output tempCount output {
                		output = tempCount;
                	} output = tempCount output tempCount System.out.println(output) System.out.println System.out System System.out output scan.close() scan.close scan String[] args args public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);

                String S = scan.next();
                String T = scan.next();

                int output = T.length();

                for (int i = 0; i <= S.length() - T.length(); i++) {
                	String tempS = S.substring(i,i+T.length());
                	int tempCount = 0;
                	for (int k = 0; k < T.length(); k++) {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	}
                	if (tempCount < output) {
                		output = tempCount;
                	}

                }

                System.out.println(output);

                scan.close();

        }

} public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);

                String S = scan.next();
                String T = scan.next();

                int output = T.length();

                for (int i = 0; i <= S.length() - T.length(); i++) {
                	String tempS = S.substring(i,i+T.length());
                	int tempCount = 0;
                	for (int k = 0; k < T.length(); k++) {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	}
                	if (tempCount < output) {
                		output = tempCount;
                	}

                }

                System.out.println(output);

                scan.close();

        }

} Main
import java.util.Scanner;

public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);

                String S = scan.next();
                String T = scan.next();

                int output = T.length();

                for (int i = 0; i <= S.length() - T.length(); i++) {
                	String tempS = S.substring(i,i+T.length());
                	int tempCount = 0;
                	for (int k = 0; k < T.length(); k++) {
                		if (!tempS.substring(k,k+1).equals(T.substring(k,k+1))) {
                			tempCount++;
                		}
                	}
                	if (tempCount < output) {
                		output = tempCount;
                	}

                }

                System.out.println(output);

                scan.close();

        }

}