import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String a = sc.next();
        String ac[] = a.split("");
		String b = sc.next(); 
        String bc[] = b.split("");
        int ans = 0;
        int count = 0;
      
        for(int i = 0;i < a.length() - (b.length() - 1);i++){
          for(int j = 0; j < b.length(); j ++){
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          }
          if(ans < count){
            ans = count;
          }
          count = 0;
        }
      	System.out.println(b.length() - ans);
 
    }
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String a = sc.next();
        String ac[] = a.split("");
		String b = sc.next(); 
        String bc[] = b.split("");
        int ans = 0;
        int count = 0;
      
        for(int i = 0;i < a.length() - (b.length() - 1);i++){
          for(int j = 0; j < b.length(); j ++){
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          }
          if(ans < count){
            ans = count;
          }
          count = 0;
        }
      	System.out.println(b.length() - ans);
 
    }
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String a = sc.next();
        String ac[] = a.split("");
		String b = sc.next(); 
        String bc[] = b.split("");
        int ans = 0;
        int count = 0;
      
        for(int i = 0;i < a.length() - (b.length() - 1);i++){
          for(int j = 0; j < b.length(); j ++){
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          }
          if(ans < count){
            ans = count;
          }
          count = 0;
        }
      	System.out.println(b.length() - ans);
 
    } main {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String a = sc.next();
        String ac[] = a.split("");
		String b = sc.next(); 
        String bc[] = b.split("");
        int ans = 0;
        int count = 0;
      
        for(int i = 0;i < a.length() - (b.length() - 1);i++){
          for(int j = 0; j < b.length(); j ++){
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          }
          if(ans < count){
            ans = count;
          }
          count = 0;
        }
      	System.out.println(b.length() - ans);
 
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc String ac[] = a.split(""); ac a.split("") a.split a "" String b = sc.next(); b sc.next() sc.next sc String bc[] = b.split(""); bc b.split("") b.split b "" int ans = 0; ans 0 int count = 0; count 0 for(int i = 0;i < a.length() - (b.length() - 1);i++){
          for(int j = 0; j < b.length(); j ++){
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          }
          if(ans < count){
            ans = count;
          }
          count = 0;
        } int i = 0; int i = 0; i 0 i < a.length() - (b.length() - 1) i a.length() - (b.length() - 1) a.length() a.length a (b.length() - 1) b.length() b.length b 1 i++ i++ i {
          for(int j = 0; j < b.length(); j ++){
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          }
          if(ans < count){
            ans = count;
          }
          count = 0;
        } {
          for(int j = 0; j < b.length(); j ++){
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          }
          if(ans < count){
            ans = count;
          }
          count = 0;
        } for(int j = 0; j < b.length(); j ++){
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          } int j = 0; int j = 0; j 0 j < b.length() j b.length() b.length b j ++ j ++ j {
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          } {
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          } if(ac[i + j].equals(bc[j])){
              count += 1;
            } ac[i + j].equals(bc[j]) ac[i + j].equals ac[i + j] ac i + j i j bc[j] bc j {
              count += 1;
            } count += 1 count 1 if(ans < count){
            ans = count;
          } ans < count ans count {
            ans = count;
          } ans = count ans count count = 0 count 0 System.out.println(b.length() - ans) System.out.println System.out System System.out b.length() - ans b.length() b.length b ans String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String a = sc.next();
        String ac[] = a.split("");
		String b = sc.next(); 
        String bc[] = b.split("");
        int ans = 0;
        int count = 0;
      
        for(int i = 0;i < a.length() - (b.length() - 1);i++){
          for(int j = 0; j < b.length(); j ++){
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          }
          if(ans < count){
            ans = count;
          }
          count = 0;
        }
      	System.out.println(b.length() - ans);
 
    }
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String a = sc.next();
        String ac[] = a.split("");
		String b = sc.next(); 
        String bc[] = b.split("");
        int ans = 0;
        int count = 0;
      
        for(int i = 0;i < a.length() - (b.length() - 1);i++){
          for(int j = 0; j < b.length(); j ++){
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          }
          if(ans < count){
            ans = count;
          }
          count = 0;
        }
      	System.out.println(b.length() - ans);
 
    }
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String a = sc.next();
        String ac[] = a.split("");
		String b = sc.next(); 
        String bc[] = b.split("");
        int ans = 0;
        int count = 0;
      
        for(int i = 0;i < a.length() - (b.length() - 1);i++){
          for(int j = 0; j < b.length(); j ++){
            if(ac[i + j].equals(bc[j])){
              count += 1;
            }
          }
          if(ans < count){
            ans = count;
          }
          count = 0;
        }
      	System.out.println(b.length() - ans);
 
    }
}