import java.util.Scanner;
import java.util.*;
public class Main {
	public static String S;
	public static String T;
	public static int sub = Integer.MAX_VALUE;

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		S = scan.next();
		T = scan.next();
		System.out.println(search());
	}

	private static int search() {
		for (int i = 0;i <= S.length() - T.length() ;i++ ) {
			int count = 0;
			for (int j = 0;j < T.length() ;j++ ) {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			}
			sub = Math.min(sub,count);
		}
		return sub;
	}

} import java.util.Scanner; Scanner java.util import java.util.*; util.* java public class Main {
	public static String S;
	public static String T;
	public static int sub = Integer.MAX_VALUE;

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		S = scan.next();
		T = scan.next();
		System.out.println(search());
	}

	private static int search() {
		for (int i = 0;i <= S.length() - T.length() ;i++ ) {
			int count = 0;
			for (int j = 0;j < T.length() ;j++ ) {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			}
			sub = Math.min(sub,count);
		}
		return sub;
	}

} Main public static String S; S public static String T; T public static int sub = Integer.MAX_VALUE; sub Integer.MAX_VALUE Integer Integer.MAX_VALUE public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		S = scan.next();
		T = scan.next();
		System.out.println(search());
	} main {
		Scanner scan = new Scanner(System.in);
		S = scan.next();
		T = scan.next();
		System.out.println(search());
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) S = scan.next() S scan.next() scan.next scan T = scan.next() T scan.next() scan.next scan System.out.println(search()) System.out.println System.out System System.out search() search String[] args args private static int search() {
		for (int i = 0;i <= S.length() - T.length() ;i++ ) {
			int count = 0;
			for (int j = 0;j < T.length() ;j++ ) {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			}
			sub = Math.min(sub,count);
		}
		return sub;
	} search {
		for (int i = 0;i <= S.length() - T.length() ;i++ ) {
			int count = 0;
			for (int j = 0;j < T.length() ;j++ ) {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			}
			sub = Math.min(sub,count);
		}
		return sub;
	} for (int i = 0;i <= S.length() - T.length() ;i++ ) {
			int count = 0;
			for (int j = 0;j < T.length() ;j++ ) {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			}
			sub = Math.min(sub,count);
		} 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 {
			int count = 0;
			for (int j = 0;j < T.length() ;j++ ) {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			}
			sub = Math.min(sub,count);
		} {
			int count = 0;
			for (int j = 0;j < T.length() ;j++ ) {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			}
			sub = Math.min(sub,count);
		} int count = 0; count 0 for (int j = 0;j < T.length() ;j++ ) {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			} int j = 0; int j = 0; j 0 j < T.length() j T.length() T.length T j++ j++ j {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			} {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			} String s_i = S.substring(i + j,i + j + 1); s_i S.substring(i + j,i + j + 1) S.substring S i + j i j i + j + 1 i + j + 1 i j 1 String t_i = T.substring(j,j + 1); t_i T.substring(j,j + 1) T.substring T j j + 1 j 1 if (!s_i.equals(t_i)) count++; !s_i.equals(t_i) s_i.equals(t_i) s_i.equals s_i t_i count++ count sub = Math.min(sub,count) sub Math.min(sub,count) Math.min Math sub count return sub; sub public class Main {
	public static String S;
	public static String T;
	public static int sub = Integer.MAX_VALUE;

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		S = scan.next();
		T = scan.next();
		System.out.println(search());
	}

	private static int search() {
		for (int i = 0;i <= S.length() - T.length() ;i++ ) {
			int count = 0;
			for (int j = 0;j < T.length() ;j++ ) {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			}
			sub = Math.min(sub,count);
		}
		return sub;
	}

} public class Main {
	public static String S;
	public static String T;
	public static int sub = Integer.MAX_VALUE;

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		S = scan.next();
		T = scan.next();
		System.out.println(search());
	}

	private static int search() {
		for (int i = 0;i <= S.length() - T.length() ;i++ ) {
			int count = 0;
			for (int j = 0;j < T.length() ;j++ ) {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			}
			sub = Math.min(sub,count);
		}
		return sub;
	}

} Main
import java.util.Scanner;
import java.util.*;
public class Main {
	public static String S;
	public static String T;
	public static int sub = Integer.MAX_VALUE;

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		S = scan.next();
		T = scan.next();
		System.out.println(search());
	}

	private static int search() {
		for (int i = 0;i <= S.length() - T.length() ;i++ ) {
			int count = 0;
			for (int j = 0;j < T.length() ;j++ ) {
				String s_i = S.substring(i + j,i + j + 1);
				String t_i = T.substring(j,j + 1);
				if (!s_i.equals(t_i)) count++;
			}
			sub = Math.min(sub,count);
		}
		return sub;
	}

}
