import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        int unmatch = 0;
        int unmatch_min = 1000;
        int cyc_max=s.length-t.length;
        for (int i=0; i<=cyc_max; i++){
            unmatch=0;
            for (int j=0; j<t.length; j++){
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            }
            if (unmatch<unmatch_min) unmatch_min=unmatch;
        }

        System.out.println(unmatch_min);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        int unmatch = 0;
        int unmatch_min = 1000;
        int cyc_max=s.length-t.length;
        for (int i=0; i<=cyc_max; i++){
            unmatch=0;
            for (int j=0; j<t.length; j++){
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            }
            if (unmatch<unmatch_min) unmatch_min=unmatch;
        }

        System.out.println(unmatch_min);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        int unmatch = 0;
        int unmatch_min = 1000;
        int cyc_max=s.length-t.length;
        for (int i=0; i<=cyc_max; i++){
            unmatch=0;
            for (int j=0; j<t.length; j++){
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            }
            if (unmatch<unmatch_min) unmatch_min=unmatch;
        }

        System.out.println(unmatch_min);
    } main {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        int unmatch = 0;
        int unmatch_min = 1000;
        int cyc_max=s.length-t.length;
        for (int i=0; i<=cyc_max; i++){
            unmatch=0;
            for (int j=0; j<t.length; j++){
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            }
            if (unmatch<unmatch_min) unmatch_min=unmatch;
        }

        System.out.println(unmatch_min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc char[] t = sc.next().toCharArray(); t sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int unmatch = 0; unmatch 0 int unmatch_min = 1000; unmatch_min 1000 int cyc_max=s.length-t.length; cyc_max s.length-t.length s.length s s.length t.length t t.length for (int i=0; i<=cyc_max; i++){
            unmatch=0;
            for (int j=0; j<t.length; j++){
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            }
            if (unmatch<unmatch_min) unmatch_min=unmatch;
        } int i=0; int i=0; i 0 i<=cyc_max i cyc_max i++ i++ i {
            unmatch=0;
            for (int j=0; j<t.length; j++){
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            }
            if (unmatch<unmatch_min) unmatch_min=unmatch;
        } {
            unmatch=0;
            for (int j=0; j<t.length; j++){
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            }
            if (unmatch<unmatch_min) unmatch_min=unmatch;
        } unmatch=0 unmatch 0 for (int j=0; j<t.length; j++){
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            } int j=0; int j=0; j 0 j<t.length j t.length t t.length j++ j++ j {
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            } {
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            } if (!(s[i+j]==t[j])) unmatch++; !(s[i+j]==t[j]) (s[i+j]==t[j]) s[i+j] s i+j i j t[j] t j unmatch++ unmatch if (unmatch>=unmatch_min) break; unmatch>=unmatch_min unmatch unmatch_min break; if (unmatch<unmatch_min) unmatch_min=unmatch; unmatch<unmatch_min unmatch unmatch_min unmatch_min=unmatch unmatch_min unmatch System.out.println(unmatch_min) System.out.println System.out System System.out unmatch_min String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        int unmatch = 0;
        int unmatch_min = 1000;
        int cyc_max=s.length-t.length;
        for (int i=0; i<=cyc_max; i++){
            unmatch=0;
            for (int j=0; j<t.length; j++){
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            }
            if (unmatch<unmatch_min) unmatch_min=unmatch;
        }

        System.out.println(unmatch_min);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        int unmatch = 0;
        int unmatch_min = 1000;
        int cyc_max=s.length-t.length;
        for (int i=0; i<=cyc_max; i++){
            unmatch=0;
            for (int j=0; j<t.length; j++){
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            }
            if (unmatch<unmatch_min) unmatch_min=unmatch;
        }

        System.out.println(unmatch_min);
    }
} Main
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        int unmatch = 0;
        int unmatch_min = 1000;
        int cyc_max=s.length-t.length;
        for (int i=0; i<=cyc_max; i++){
            unmatch=0;
            for (int j=0; j<t.length; j++){
                if (!(s[i+j]==t[j])) unmatch++;
              	if (unmatch>=unmatch_min) break;
            }
            if (unmatch<unmatch_min) unmatch_min=unmatch;
        }

        System.out.println(unmatch_min);
    }
}