import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		int slen = s.length;
		int tlen = t.length;
		
		//答えansを仮置きする。
		//これが十分に大きくないと不正解となるので、
		//この値なら絶対に正しい答えが出る、という値を仮置きすること
		int ans = tlen;
		
		for(int start = 0; start <= slen-tlen; start++){
			int diff = 0;
			for(int i = 0; i < tlen; i++){
				if(t[i] != s[start+i]){
					diff++;
				}
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		int slen = s.length;
		int tlen = t.length;
		
		//答えansを仮置きする。
		//これが十分に大きくないと不正解となるので、
		//この値なら絶対に正しい答えが出る、という値を仮置きすること
		int ans = tlen;
		
		for(int start = 0; start <= slen-tlen; start++){
			int diff = 0;
			for(int i = 0; i < tlen; i++){
				if(t[i] != s[start+i]){
					diff++;
				}
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		int slen = s.length;
		int tlen = t.length;
		
		//答えansを仮置きする。
		//これが十分に大きくないと不正解となるので、
		//この値なら絶対に正しい答えが出る、という値を仮置きすること
		int ans = tlen;
		
		for(int start = 0; start <= slen-tlen; start++){
			int diff = 0;
			for(int i = 0; i < tlen; i++){
				if(t[i] != s[start+i]){
					diff++;
				}
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		int slen = s.length;
		int tlen = t.length;
		
		//答えansを仮置きする。
		//これが十分に大きくないと不正解となるので、
		//この値なら絶対に正しい答えが出る、という値を仮置きすること
		int ans = tlen;
		
		for(int start = 0; start <= slen-tlen; start++){
			int diff = 0;
			for(int i = 0; i < tlen; i++){
				if(t[i] != s[start+i]){
					diff++;
				}
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc char[] s = S.toCharArray(); s S.toCharArray() S.toCharArray S char[] t = T.toCharArray(); t T.toCharArray() T.toCharArray T int slen = s.length; slen s.length s s.length int tlen = t.length; tlen t.length t t.length int ans = tlen; ans tlen for(int start = 0; start <= slen-tlen; start++){
			int diff = 0;
			for(int i = 0; i < tlen; i++){
				if(t[i] != s[start+i]){
					diff++;
				}
			}
			ans = Math.min(ans, diff);
		} int start = 0; int start = 0; start 0 start <= slen-tlen start slen-tlen slen tlen start++ start++ start {
			int diff = 0;
			for(int i = 0; i < tlen; i++){
				if(t[i] != s[start+i]){
					diff++;
				}
			}
			ans = Math.min(ans, diff);
		} {
			int diff = 0;
			for(int i = 0; i < tlen; i++){
				if(t[i] != s[start+i]){
					diff++;
				}
			}
			ans = Math.min(ans, diff);
		} int diff = 0; diff 0 for(int i = 0; i < tlen; i++){
				if(t[i] != s[start+i]){
					diff++;
				}
			} int i = 0; int i = 0; i 0 i < tlen i tlen i++ i++ i {
				if(t[i] != s[start+i]){
					diff++;
				}
			} {
				if(t[i] != s[start+i]){
					diff++;
				}
			} if(t[i] != s[start+i]){
					diff++;
				} t[i] != s[start+i] t[i] t i s[start+i] s start+i start i {
					diff++;
				} diff++ diff ans = Math.min(ans, diff) ans Math.min(ans, diff) Math.min Math ans diff 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);
		String S = sc.next();
		String T = sc.next();
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		int slen = s.length;
		int tlen = t.length;
		
		//答えansを仮置きする。
		//これが十分に大きくないと不正解となるので、
		//この値なら絶対に正しい答えが出る、という値を仮置きすること
		int ans = tlen;
		
		for(int start = 0; start <= slen-tlen; start++){
			int diff = 0;
			for(int i = 0; i < tlen; i++){
				if(t[i] != s[start+i]){
					diff++;
				}
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		int slen = s.length;
		int tlen = t.length;
		
		//答えansを仮置きする。
		//これが十分に大きくないと不正解となるので、
		//この値なら絶対に正しい答えが出る、という値を仮置きすること
		int ans = tlen;
		
		for(int start = 0; start <= slen-tlen; start++){
			int diff = 0;
			for(int i = 0; i < tlen; i++){
				if(t[i] != s[start+i]){
					diff++;
				}
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
	}
} Main
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		char[] s = S.toCharArray();
		char[] t = T.toCharArray();
		int slen = s.length;
		int tlen = t.length;
		
		//答えansを仮置きする。
		//これが十分に大きくないと不正解となるので、
		//この値なら絶対に正しい答えが出る、という値を仮置きすること
		int ans = tlen;
		
		for(int start = 0; start <= slen-tlen; start++){
			int diff = 0;
			for(int i = 0; i < tlen; i++){
				if(t[i] != s[start+i]){
					diff++;
				}
			}
			ans = Math.min(ans, diff);
		}
		
		System.out.println(ans);
	}
}