import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

      public static void main(String[] args) {

            Scanner sc = new Scanner(System.in);
            String s = sc.next();
            String t = sc.next();
            int ans = t.length() + 1;
            for (int i = 0; i < (s.length() - t.length()) + 1; i++) {
                  int tmp =0;
                  for(int j = 0;j<t.length();j++){
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  }
                  ans = Math.min(ans,tmp);
            }
            System.out.println(ans);

      }


} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner 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();
            int ans = t.length() + 1;
            for (int i = 0; i < (s.length() - t.length()) + 1; i++) {
                  int tmp =0;
                  for(int j = 0;j<t.length();j++){
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  }
                  ans = Math.min(ans,tmp);
            }
            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();
            int ans = t.length() + 1;
            for (int i = 0; i < (s.length() - t.length()) + 1; i++) {
                  int tmp =0;
                  for(int j = 0;j<t.length();j++){
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  }
                  ans = Math.min(ans,tmp);
            }
            System.out.println(ans);

      } main {

            Scanner sc = new Scanner(System.in);
            String s = sc.next();
            String t = sc.next();
            int ans = t.length() + 1;
            for (int i = 0; i < (s.length() - t.length()) + 1; i++) {
                  int tmp =0;
                  for(int j = 0;j<t.length();j++){
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  }
                  ans = Math.min(ans,tmp);
            }
            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 int ans = t.length() + 1; ans t.length() + 1 t.length() t.length t 1 for (int i = 0; i < (s.length() - t.length()) + 1; i++) {
                  int tmp =0;
                  for(int j = 0;j<t.length();j++){
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  }
                  ans = Math.min(ans,tmp);
            } int i = 0; int i = 0; i 0 i < (s.length() - t.length()) + 1 i (s.length() - t.length()) + 1 (s.length() - t.length()) s.length() s.length s t.length() t.length t 1 i++ i++ i {
                  int tmp =0;
                  for(int j = 0;j<t.length();j++){
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  }
                  ans = Math.min(ans,tmp);
            } {
                  int tmp =0;
                  for(int j = 0;j<t.length();j++){
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  }
                  ans = Math.min(ans,tmp);
            } int tmp =0; tmp 0 for(int j = 0;j<t.length();j++){
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  } int j = 0; int j = 0; j 0 j<t.length() j t.length() t.length t j++ j++ j {
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  } {
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  } if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        } t.charAt(j) != s.charAt(i+j) t.charAt(j) t.charAt t j s.charAt(i+j) s.charAt s i+j i j {
                              tmp++;
                        } tmp++ tmp ans = Math.min(ans,tmp) ans Math.min(ans,tmp) Math.min Math ans tmp 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();
            int ans = t.length() + 1;
            for (int i = 0; i < (s.length() - t.length()) + 1; i++) {
                  int tmp =0;
                  for(int j = 0;j<t.length();j++){
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  }
                  ans = Math.min(ans,tmp);
            }
            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();
            int ans = t.length() + 1;
            for (int i = 0; i < (s.length() - t.length()) + 1; i++) {
                  int tmp =0;
                  for(int j = 0;j<t.length();j++){
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  }
                  ans = Math.min(ans,tmp);
            }
            System.out.println(ans);

      }


} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

      public static void main(String[] args) {

            Scanner sc = new Scanner(System.in);
            String s = sc.next();
            String t = sc.next();
            int ans = t.length() + 1;
            for (int i = 0; i < (s.length() - t.length()) + 1; i++) {
                  int tmp =0;
                  for(int j = 0;j<t.length();j++){
                        if (t.charAt(j) != s.charAt(i+j)){
                              tmp++;
                        }
                  }
                  ans = Math.min(ans,tmp);
            }
            System.out.println(ans);

      }


}
