import java.util.Scanner;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int ans = 30000;
    char[] s = sc.next().toCharArray();
    int sl = s.length;
    char[] t = sc.next().toCharArray();
    int tl = t.length;

    for (int cnt = 0; cnt < (sl - tl + 1); cnt++) {
      int tmp = 0;
      for (int j = 0; j < tl; j++) {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      }
      ans = Math.min(ans, tmp);
    }

    System.out.println(ans);
    sc.close();
  }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int ans = 30000;
    char[] s = sc.next().toCharArray();
    int sl = s.length;
    char[] t = sc.next().toCharArray();
    int tl = t.length;

    for (int cnt = 0; cnt < (sl - tl + 1); cnt++) {
      int tmp = 0;
      for (int j = 0; j < tl; j++) {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      }
      ans = Math.min(ans, tmp);
    }

    System.out.println(ans);
    sc.close();
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int ans = 30000;
    char[] s = sc.next().toCharArray();
    int sl = s.length;
    char[] t = sc.next().toCharArray();
    int tl = t.length;

    for (int cnt = 0; cnt < (sl - tl + 1); cnt++) {
      int tmp = 0;
      for (int j = 0; j < tl; j++) {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      }
      ans = Math.min(ans, tmp);
    }

    System.out.println(ans);
    sc.close();
  } main {
    Scanner sc = new Scanner(System.in);
    int ans = 30000;
    char[] s = sc.next().toCharArray();
    int sl = s.length;
    char[] t = sc.next().toCharArray();
    int tl = t.length;

    for (int cnt = 0; cnt < (sl - tl + 1); cnt++) {
      int tmp = 0;
      for (int j = 0; j < tl; j++) {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      }
      ans = Math.min(ans, tmp);
    }

    System.out.println(ans);
    sc.close();
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int ans = 30000; ans 30000 char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int sl = s.length; sl s.length s s.length char[] t = sc.next().toCharArray(); t sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int tl = t.length; tl t.length t t.length for (int cnt = 0; cnt < (sl - tl + 1); cnt++) {
      int tmp = 0;
      for (int j = 0; j < tl; j++) {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      }
      ans = Math.min(ans, tmp);
    } int cnt = 0; int cnt = 0; cnt 0 cnt < (sl - tl + 1) cnt (sl - tl + 1) sl - tl sl tl 1 cnt++ cnt++ cnt {
      int tmp = 0;
      for (int j = 0; j < tl; j++) {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      }
      ans = Math.min(ans, tmp);
    } {
      int tmp = 0;
      for (int j = 0; j < tl; j++) {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      }
      ans = Math.min(ans, tmp);
    } int tmp = 0; tmp 0 for (int j = 0; j < tl; j++) {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      } int j = 0; int j = 0; j 0 j < tl j tl j++ j++ j {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      } {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      } if (s[cnt + j] != t[j]) {
          tmp++;
        } s[cnt + j] != t[j] s[cnt + j] s cnt + j cnt j t[j] t 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 sc.close() sc.close sc String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int ans = 30000;
    char[] s = sc.next().toCharArray();
    int sl = s.length;
    char[] t = sc.next().toCharArray();
    int tl = t.length;

    for (int cnt = 0; cnt < (sl - tl + 1); cnt++) {
      int tmp = 0;
      for (int j = 0; j < tl; j++) {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      }
      ans = Math.min(ans, tmp);
    }

    System.out.println(ans);
    sc.close();
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int ans = 30000;
    char[] s = sc.next().toCharArray();
    int sl = s.length;
    char[] t = sc.next().toCharArray();
    int tl = t.length;

    for (int cnt = 0; cnt < (sl - tl + 1); cnt++) {
      int tmp = 0;
      for (int j = 0; j < tl; j++) {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      }
      ans = Math.min(ans, tmp);
    }

    System.out.println(ans);
    sc.close();
  }
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int ans = 30000;
    char[] s = sc.next().toCharArray();
    int sl = s.length;
    char[] t = sc.next().toCharArray();
    int tl = t.length;

    for (int cnt = 0; cnt < (sl - tl + 1); cnt++) {
      int tmp = 0;
      for (int j = 0; j < tl; j++) {
        if (s[cnt + j] != t[j]) {
          tmp++;
        }
      }
      ans = Math.min(ans, tmp);
    }

    System.out.println(ans);
    sc.close();
  }
}