import java.util.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		char[] c = sc.next().toCharArray();
		int ans = Integer.MAX_VALUE;

		for(int i = 0;i <= s.length-c.length; ++i) {
			int j = 0, k = i, count = 0;
			while(j < c.length) {
				if(c[j++] != s[k++]) count++;
			}
			ans = Math.min(ans,count);
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java import java.lang.*; lang.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		char[] c = sc.next().toCharArray();
		int ans = Integer.MAX_VALUE;

		for(int i = 0;i <= s.length-c.length; ++i) {
			int j = 0, k = i, count = 0;
			while(j < c.length) {
				if(c[j++] != s[k++]) count++;
			}
			ans = Math.min(ans,count);
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		char[] c = sc.next().toCharArray();
		int ans = Integer.MAX_VALUE;

		for(int i = 0;i <= s.length-c.length; ++i) {
			int j = 0, k = i, count = 0;
			while(j < c.length) {
				if(c[j++] != s[k++]) count++;
			}
			ans = Math.min(ans,count);
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		char[] c = sc.next().toCharArray();
		int ans = Integer.MAX_VALUE;

		for(int i = 0;i <= s.length-c.length; ++i) {
			int j = 0, k = i, count = 0;
			while(j < c.length) {
				if(c[j++] != s[k++]) count++;
			}
			ans = Math.min(ans,count);
		}
		System.out.println(ans);
	} 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[] c = sc.next().toCharArray(); c sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0;i <= s.length-c.length; ++i) {
			int j = 0, k = i, count = 0;
			while(j < c.length) {
				if(c[j++] != s[k++]) count++;
			}
			ans = Math.min(ans,count);
		} int i = 0; int i = 0; i 0 i <= s.length-c.length i s.length-c.length s.length s s.length c.length c c.length ++i ++i i {
			int j = 0, k = i, count = 0;
			while(j < c.length) {
				if(c[j++] != s[k++]) count++;
			}
			ans = Math.min(ans,count);
		} {
			int j = 0, k = i, count = 0;
			while(j < c.length) {
				if(c[j++] != s[k++]) count++;
			}
			ans = Math.min(ans,count);
		} int j = 0 j 0 k = i k i count = 0; count 0 while(j < c.length) {
				if(c[j++] != s[k++]) count++;
			} j < c.length j c.length c c.length {
				if(c[j++] != s[k++]) count++;
			} if(c[j++] != s[k++]) count++; c[j++] != s[k++] c[j++] c j++ j s[k++] s k++ k count++ count ans = Math.min(ans,count) ans Math.min(ans,count) Math.min Math ans count System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		char[] c = sc.next().toCharArray();
		int ans = Integer.MAX_VALUE;

		for(int i = 0;i <= s.length-c.length; ++i) {
			int j = 0, k = i, count = 0;
			while(j < c.length) {
				if(c[j++] != s[k++]) count++;
			}
			ans = Math.min(ans,count);
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		char[] c = sc.next().toCharArray();
		int ans = Integer.MAX_VALUE;

		for(int i = 0;i <= s.length-c.length; ++i) {
			int j = 0, k = i, count = 0;
			while(j < c.length) {
				if(c[j++] != s[k++]) count++;
			}
			ans = Math.min(ans,count);
		}
		System.out.println(ans);
	}
} Main
import java.util.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		char[] c = sc.next().toCharArray();
		int ans = Integer.MAX_VALUE;

		for(int i = 0;i <= s.length-c.length; ++i) {
			int j = 0, k = i, count = 0;
			while(j < c.length) {
				if(c[j++] != s[k++]) count++;
			}
			ans = Math.min(ans,count);
		}
		System.out.println(ans);
	}
}