import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      	String T = sc.nextLine();
      	int max = Integer.MIN_VALUE;
      int s = S.length();
      int t = T.length();
      if(s<t) return;
      for(int i=0; i<=s-t; i++){
        int count = 0;
        for(int j=0; j<t; j++){
          if(S.charAt(i+j) == T.charAt(j)) count++;
        }
        max = Math.max(max, count);
      }
      	System.out.println(t - max);
	}
} import java.util.*; util.* java public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      	String T = sc.nextLine();
      	int max = Integer.MIN_VALUE;
      int s = S.length();
      int t = T.length();
      if(s<t) return;
      for(int i=0; i<=s-t; i++){
        int count = 0;
        for(int j=0; j<t; j++){
          if(S.charAt(i+j) == T.charAt(j)) count++;
        }
        max = Math.max(max, count);
      }
      	System.out.println(t - max);
	}
} Main public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      	String T = sc.nextLine();
      	int max = Integer.MIN_VALUE;
      int s = S.length();
      int t = T.length();
      if(s<t) return;
      for(int i=0; i<=s-t; i++){
        int count = 0;
        for(int j=0; j<t; j++){
          if(S.charAt(i+j) == T.charAt(j)) count++;
        }
        max = Math.max(max, count);
      }
      	System.out.println(t - max);
	} main {
		Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      	String T = sc.nextLine();
      	int max = Integer.MIN_VALUE;
      int s = S.length();
      int t = T.length();
      if(s<t) return;
      for(int i=0; i<=s-t; i++){
        int count = 0;
        for(int j=0; j<t; j++){
          if(S.charAt(i+j) == T.charAt(j)) count++;
        }
        max = Math.max(max, count);
      }
      	System.out.println(t - max);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc String T = sc.nextLine(); T sc.nextLine() sc.nextLine sc int max = Integer.MIN_VALUE; max Integer.MIN_VALUE Integer Integer.MIN_VALUE int s = S.length(); s S.length() S.length S int t = T.length(); t T.length() T.length T if(s<t) return; s<t s t return; for(int i=0; i<=s-t; i++){
        int count = 0;
        for(int j=0; j<t; j++){
          if(S.charAt(i+j) == T.charAt(j)) count++;
        }
        max = Math.max(max, count);
      } int i=0; int i=0; i 0 i<=s-t i s-t s t i++ i++ i {
        int count = 0;
        for(int j=0; j<t; j++){
          if(S.charAt(i+j) == T.charAt(j)) count++;
        }
        max = Math.max(max, count);
      } {
        int count = 0;
        for(int j=0; j<t; j++){
          if(S.charAt(i+j) == T.charAt(j)) count++;
        }
        max = Math.max(max, count);
      } int count = 0; count 0 for(int j=0; j<t; j++){
          if(S.charAt(i+j) == T.charAt(j)) count++;
        } int j=0; int j=0; j 0 j<t j t j++ j++ j {
          if(S.charAt(i+j) == T.charAt(j)) count++;
        } {
          if(S.charAt(i+j) == T.charAt(j)) count++;
        } if(S.charAt(i+j) == T.charAt(j)) count++; S.charAt(i+j) == T.charAt(j) S.charAt(i+j) S.charAt S i+j i j T.charAt(j) T.charAt T j count++ count max = Math.max(max, count) max Math.max(max, count) Math.max Math max count System.out.println(t - max) System.out.println System.out System System.out t - max t max String[] args args public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      	String T = sc.nextLine();
      	int max = Integer.MIN_VALUE;
      int s = S.length();
      int t = T.length();
      if(s<t) return;
      for(int i=0; i<=s-t; i++){
        int count = 0;
        for(int j=0; j<t; j++){
          if(S.charAt(i+j) == T.charAt(j)) count++;
        }
        max = Math.max(max, count);
      }
      	System.out.println(t - max);
	}
} public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      	String T = sc.nextLine();
      	int max = Integer.MIN_VALUE;
      int s = S.length();
      int t = T.length();
      if(s<t) return;
      for(int i=0; i<=s-t; i++){
        int count = 0;
        for(int j=0; j<t; j++){
          if(S.charAt(i+j) == T.charAt(j)) count++;
        }
        max = Math.max(max, count);
      }
      	System.out.println(t - max);
	}
} Main
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      	String T = sc.nextLine();
      	int max = Integer.MIN_VALUE;
      int s = S.length();
      int t = T.length();
      if(s<t) return;
      for(int i=0; i<=s-t; i++){
        int count = 0;
        for(int j=0; j<t; j++){
          if(S.charAt(i+j) == T.charAt(j)) count++;
        }
        max = Math.max(max, count);
      }
      	System.out.println(t - max);
	}
}