import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
      	String t = sc.next();
      	String ss;
      	int lim = s.length()-t.length()+1;
      	int cnt=0;
      	int cnt_min = t.length();
      
      	for(int i = 0;i < lim;i++){
          ss = s.substring(i,i+t.length());
          cnt = 0;
          for(int j = 0; j < t.length();j++){
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          }
          if(cnt_min > cnt) cnt_min = cnt;
        }
      
      	System.out.println(cnt_min);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
      	String t = sc.next();
      	String ss;
      	int lim = s.length()-t.length()+1;
      	int cnt=0;
      	int cnt_min = t.length();
      
      	for(int i = 0;i < lim;i++){
          ss = s.substring(i,i+t.length());
          cnt = 0;
          for(int j = 0; j < t.length();j++){
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          }
          if(cnt_min > cnt) cnt_min = cnt;
        }
      
      	System.out.println(cnt_min);
	}
} Main public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
      	String t = sc.next();
      	String ss;
      	int lim = s.length()-t.length()+1;
      	int cnt=0;
      	int cnt_min = t.length();
      
      	for(int i = 0;i < lim;i++){
          ss = s.substring(i,i+t.length());
          cnt = 0;
          for(int j = 0; j < t.length();j++){
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          }
          if(cnt_min > cnt) cnt_min = cnt;
        }
      
      	System.out.println(cnt_min);
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
      	String t = sc.next();
      	String ss;
      	int lim = s.length()-t.length()+1;
      	int cnt=0;
      	int cnt_min = t.length();
      
      	for(int i = 0;i < lim;i++){
          ss = s.substring(i,i+t.length());
          cnt = 0;
          for(int j = 0; j < t.length();j++){
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          }
          if(cnt_min > cnt) cnt_min = cnt;
        }
      
      	System.out.println(cnt_min);
	} 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 String ss; ss int lim = s.length()-t.length()+1; lim s.length()-t.length()+1 s.length()-t.length() s.length() s.length s t.length() t.length t 1 int cnt=0; cnt 0 int cnt_min = t.length(); cnt_min t.length() t.length t for(int i = 0;i < lim;i++){
          ss = s.substring(i,i+t.length());
          cnt = 0;
          for(int j = 0; j < t.length();j++){
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          }
          if(cnt_min > cnt) cnt_min = cnt;
        } int i = 0; int i = 0; i 0 i < lim i lim i++ i++ i {
          ss = s.substring(i,i+t.length());
          cnt = 0;
          for(int j = 0; j < t.length();j++){
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          }
          if(cnt_min > cnt) cnt_min = cnt;
        } {
          ss = s.substring(i,i+t.length());
          cnt = 0;
          for(int j = 0; j < t.length();j++){
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          }
          if(cnt_min > cnt) cnt_min = cnt;
        } ss = s.substring(i,i+t.length()) ss s.substring(i,i+t.length()) s.substring s i i+t.length() i t.length() t.length t cnt = 0 cnt 0 for(int j = 0; j < t.length();j++){
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          } int j = 0; int j = 0; j 0 j < t.length() j t.length() t.length t j++ j++ j {
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          } {
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          } if(ss.charAt(j) != t.charAt(j)) cnt++; ss.charAt(j) != t.charAt(j) ss.charAt(j) ss.charAt ss j t.charAt(j) t.charAt t j cnt++ cnt if(cnt_min > cnt) cnt_min = cnt; cnt_min > cnt cnt_min cnt cnt_min = cnt cnt_min cnt System.out.println(cnt_min) System.out.println System.out System System.out cnt_min String[] args args public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
      	String t = sc.next();
      	String ss;
      	int lim = s.length()-t.length()+1;
      	int cnt=0;
      	int cnt_min = t.length();
      
      	for(int i = 0;i < lim;i++){
          ss = s.substring(i,i+t.length());
          cnt = 0;
          for(int j = 0; j < t.length();j++){
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          }
          if(cnt_min > cnt) cnt_min = cnt;
        }
      
      	System.out.println(cnt_min);
	}
} public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
      	String t = sc.next();
      	String ss;
      	int lim = s.length()-t.length()+1;
      	int cnt=0;
      	int cnt_min = t.length();
      
      	for(int i = 0;i < lim;i++){
          ss = s.substring(i,i+t.length());
          cnt = 0;
          for(int j = 0; j < t.length();j++){
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          }
          if(cnt_min > cnt) cnt_min = cnt;
        }
      
      	System.out.println(cnt_min);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
      	String t = sc.next();
      	String ss;
      	int lim = s.length()-t.length()+1;
      	int cnt=0;
      	int cnt_min = t.length();
      
      	for(int i = 0;i < lim;i++){
          ss = s.substring(i,i+t.length());
          cnt = 0;
          for(int j = 0; j < t.length();j++){
            if(ss.charAt(j) != t.charAt(j)) cnt++;
          }
          if(cnt_min > cnt) cnt_min = cnt;
        }
      
      	System.out.println(cnt_min);
	}
}
