import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		char[] s = sc.nextLine().toCharArray();
		char[] t = sc.nextLine().toCharArray();
		int   sl = s.length;
		int   tl = t.length;

		int max  = 0;

		for(int i = 0; i < sl - tl + 1; i ++) {

			int cnt = 0;

			for(int j = 0; j < tl; j++) {

				if(s[i + j] == t[j])cnt++;
			}

			max = Math.max(max, cnt);
		}


		System.out.println(tl - max);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		char[] s = sc.nextLine().toCharArray();
		char[] t = sc.nextLine().toCharArray();
		int   sl = s.length;
		int   tl = t.length;

		int max  = 0;

		for(int i = 0; i < sl - tl + 1; i ++) {

			int cnt = 0;

			for(int j = 0; j < tl; j++) {

				if(s[i + j] == t[j])cnt++;
			}

			max = Math.max(max, cnt);
		}


		System.out.println(tl - max);
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		char[] s = sc.nextLine().toCharArray();
		char[] t = sc.nextLine().toCharArray();
		int   sl = s.length;
		int   tl = t.length;

		int max  = 0;

		for(int i = 0; i < sl - tl + 1; i ++) {

			int cnt = 0;

			for(int j = 0; j < tl; j++) {

				if(s[i + j] == t[j])cnt++;
			}

			max = Math.max(max, cnt);
		}


		System.out.println(tl - max);
	} main {

		Scanner sc = new Scanner(System.in);
		char[] s = sc.nextLine().toCharArray();
		char[] t = sc.nextLine().toCharArray();
		int   sl = s.length;
		int   tl = t.length;

		int max  = 0;

		for(int i = 0; i < sl - tl + 1; i ++) {

			int cnt = 0;

			for(int j = 0; j < tl; j++) {

				if(s[i + j] == t[j])cnt++;
			}

			max = Math.max(max, cnt);
		}


		System.out.println(tl - max);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.nextLine().toCharArray(); s sc.nextLine().toCharArray() sc.nextLine().toCharArray sc.nextLine() sc.nextLine sc char[] t = sc.nextLine().toCharArray(); t sc.nextLine().toCharArray() sc.nextLine().toCharArray sc.nextLine() sc.nextLine sc int   sl = s.length; sl s.length s s.length int   tl = t.length; tl t.length t t.length int max  = 0; max 0 for(int i = 0; i < sl - tl + 1; i ++) {

			int cnt = 0;

			for(int j = 0; j < tl; j++) {

				if(s[i + j] == t[j])cnt++;
			}

			max = Math.max(max, cnt);
		} int i = 0; int i = 0; i 0 i < sl - tl + 1 i sl - tl + 1 sl - tl sl tl 1 i ++ i ++ i {

			int cnt = 0;

			for(int j = 0; j < tl; j++) {

				if(s[i + j] == t[j])cnt++;
			}

			max = Math.max(max, cnt);
		} {

			int cnt = 0;

			for(int j = 0; j < tl; j++) {

				if(s[i + j] == t[j])cnt++;
			}

			max = Math.max(max, cnt);
		} int cnt = 0; cnt 0 for(int j = 0; j < tl; j++) {

				if(s[i + j] == t[j])cnt++;
			} int j = 0; int j = 0; j 0 j < tl j tl j++ j++ j {

				if(s[i + j] == t[j])cnt++;
			} {

				if(s[i + j] == t[j])cnt++;
			} if(s[i + j] == t[j])cnt++; s[i + j] == t[j] s[i + j] s i + j i j t[j] t j cnt++ cnt max = Math.max(max, cnt) max Math.max(max, cnt) Math.max Math max cnt System.out.println(tl - max) System.out.println System.out System System.out tl - max tl max String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		char[] s = sc.nextLine().toCharArray();
		char[] t = sc.nextLine().toCharArray();
		int   sl = s.length;
		int   tl = t.length;

		int max  = 0;

		for(int i = 0; i < sl - tl + 1; i ++) {

			int cnt = 0;

			for(int j = 0; j < tl; j++) {

				if(s[i + j] == t[j])cnt++;
			}

			max = Math.max(max, cnt);
		}


		System.out.println(tl - max);
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		char[] s = sc.nextLine().toCharArray();
		char[] t = sc.nextLine().toCharArray();
		int   sl = s.length;
		int   tl = t.length;

		int max  = 0;

		for(int i = 0; i < sl - tl + 1; i ++) {

			int cnt = 0;

			for(int j = 0; j < tl; j++) {

				if(s[i + j] == t[j])cnt++;
			}

			max = Math.max(max, cnt);
		}


		System.out.println(tl - max);
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		char[] s = sc.nextLine().toCharArray();
		char[] t = sc.nextLine().toCharArray();
		int   sl = s.length;
		int   tl = t.length;

		int max  = 0;

		for(int i = 0; i < sl - tl + 1; i ++) {

			int cnt = 0;

			for(int j = 0; j < tl; j++) {

				if(s[i + j] == t[j])cnt++;
			}

			max = Math.max(max, cnt);
		}


		System.out.println(tl - max);
	}
}
