import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		char[] T = sc.next().toCharArray();
		int c, max= 0;
		for(int i = 0; i < S.length - T.length + 1; i++) {
			c = 0;
			for(int j = 0; j < T.length; j++)
				if(S[i+j] == T[j])
					c++;
			max = Math.max(max, c);
		}
		System.out.println(T.length - max);
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		char[] T = sc.next().toCharArray();
		int c, max= 0;
		for(int i = 0; i < S.length - T.length + 1; i++) {
			c = 0;
			for(int j = 0; j < T.length; j++)
				if(S[i+j] == T[j])
					c++;
			max = Math.max(max, c);
		}
		System.out.println(T.length - max);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		char[] T = sc.next().toCharArray();
		int c, max= 0;
		for(int i = 0; i < S.length - T.length + 1; i++) {
			c = 0;
			for(int j = 0; j < T.length; j++)
				if(S[i+j] == T[j])
					c++;
			max = Math.max(max, c);
		}
		System.out.println(T.length - max);
	} main {
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		char[] T = sc.next().toCharArray();
		int c, max= 0;
		for(int i = 0; i < S.length - T.length + 1; i++) {
			c = 0;
			for(int j = 0; j < T.length; j++)
				if(S[i+j] == T[j])
					c++;
			max = Math.max(max, c);
		}
		System.out.println(T.length - max);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] S = sc.next().toCharArray(); S sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc char[] T = sc.next().toCharArray(); T sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int c c max= 0; max 0 for(int i = 0; i < S.length - T.length + 1; i++) {
			c = 0;
			for(int j = 0; j < T.length; j++)
				if(S[i+j] == T[j])
					c++;
			max = Math.max(max, c);
		} int i = 0; int i = 0; i 0 i < S.length - T.length + 1 i S.length - T.length + 1 S.length - T.length S.length S S.length T.length T T.length 1 i++ i++ i {
			c = 0;
			for(int j = 0; j < T.length; j++)
				if(S[i+j] == T[j])
					c++;
			max = Math.max(max, c);
		} {
			c = 0;
			for(int j = 0; j < T.length; j++)
				if(S[i+j] == T[j])
					c++;
			max = Math.max(max, c);
		} c = 0 c 0 for(int j = 0; j < T.length; j++)
				if(S[i+j] == T[j])
					c++; int j = 0; int j = 0; j 0 j < T.length j T.length T T.length j++ j++ j if(S[i+j] == T[j])
					c++; if(S[i+j] == T[j])
					c++; S[i+j] == T[j] S[i+j] S i+j i j T[j] T j c++ c max = Math.max(max, c) max Math.max(max, c) Math.max Math max c System.out.println(T.length - max) System.out.println System.out System System.out T.length - max T.length T T.length max String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		char[] T = sc.next().toCharArray();
		int c, max= 0;
		for(int i = 0; i < S.length - T.length + 1; i++) {
			c = 0;
			for(int j = 0; j < T.length; j++)
				if(S[i+j] == T[j])
					c++;
			max = Math.max(max, c);
		}
		System.out.println(T.length - max);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		char[] T = sc.next().toCharArray();
		int c, max= 0;
		for(int i = 0; i < S.length - T.length + 1; i++) {
			c = 0;
			for(int j = 0; j < T.length; j++)
				if(S[i+j] == T[j])
					c++;
			max = Math.max(max, c);
		}
		System.out.println(T.length - max);
	}

} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		char[] T = sc.next().toCharArray();
		int c, max= 0;
		for(int i = 0; i < S.length - T.length + 1; i++) {
			c = 0;
			for(int j = 0; j < T.length; j++)
				if(S[i+j] == T[j])
					c++;
			max = Math.max(max, c);
		}
		System.out.println(T.length - max);
	}

}
