import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.HashSet;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String  S=sc.next();
    String  T=sc.next();
    String []Ss = S.split("");
    String []Ts = T.split("");


    int Sum=0;
    int Ans=1001;
for (int i=0;i<Ss.length-Ts.length+1 ;i++){
  for (int j=0;j<Ts.length ;j++) {
     if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     }
  }
  if(Ans>Sum){
    Ans=Sum;
  }
  Sum=0;

}
System.out.println(Ans);
}
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.stream.Collectors; Collectors java.util.stream import java.util.HashSet; HashSet java.util class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String  S=sc.next();
    String  T=sc.next();
    String []Ss = S.split("");
    String []Ts = T.split("");


    int Sum=0;
    int Ans=1001;
for (int i=0;i<Ss.length-Ts.length+1 ;i++){
  for (int j=0;j<Ts.length ;j++) {
     if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     }
  }
  if(Ans>Sum){
    Ans=Sum;
  }
  Sum=0;

}
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();
    String []Ss = S.split("");
    String []Ts = T.split("");


    int Sum=0;
    int Ans=1001;
for (int i=0;i<Ss.length-Ts.length+1 ;i++){
  for (int j=0;j<Ts.length ;j++) {
     if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     }
  }
  if(Ans>Sum){
    Ans=Sum;
  }
  Sum=0;

}
System.out.println(Ans);
} main {
    Scanner sc = new Scanner(System.in);
    String  S=sc.next();
    String  T=sc.next();
    String []Ss = S.split("");
    String []Ts = T.split("");


    int Sum=0;
    int Ans=1001;
for (int i=0;i<Ss.length-Ts.length+1 ;i++){
  for (int j=0;j<Ts.length ;j++) {
     if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     }
  }
  if(Ans>Sum){
    Ans=Sum;
  }
  Sum=0;

}
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 String []Ss = S.split(""); Ss S.split("") S.split S "" String []Ts = T.split(""); Ts T.split("") T.split T "" int Sum=0; Sum 0 int Ans=1001; Ans 1001 for (int i=0;i<Ss.length-Ts.length+1 ;i++){
  for (int j=0;j<Ts.length ;j++) {
     if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     }
  }
  if(Ans>Sum){
    Ans=Sum;
  }
  Sum=0;

} int i=0; int i=0; i 0 i<Ss.length-Ts.length+1 i Ss.length-Ts.length+1 Ss.length-Ts.length Ss.length Ss Ss.length Ts.length Ts Ts.length 1 i++ i++ i {
  for (int j=0;j<Ts.length ;j++) {
     if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     }
  }
  if(Ans>Sum){
    Ans=Sum;
  }
  Sum=0;

} {
  for (int j=0;j<Ts.length ;j++) {
     if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     }
  }
  if(Ans>Sum){
    Ans=Sum;
  }
  Sum=0;

} for (int j=0;j<Ts.length ;j++) {
     if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     }
  } int j=0; int j=0; j 0 j<Ts.length j Ts.length Ts Ts.length j++ j++ j {
     if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     }
  } {
     if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     }
  } if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     } !(Ss[i+j].equals(Ts[j])) (Ss[i+j].equals(Ts[j])) Ss[i+j].equals Ss[i+j] Ss i+j i j Ts[j] Ts j {
       Sum++;
     } Sum++ Sum if(Ans>Sum){
    Ans=Sum;
  } Ans>Sum Ans Sum {
    Ans=Sum;
  } Ans=Sum Ans Sum Sum=0 Sum 0 System.out.println(Ans) System.out.println System.out System System.out Ans String[] args args
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.HashSet;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String  S=sc.next();
    String  T=sc.next();
    String []Ss = S.split("");
    String []Ts = T.split("");


    int Sum=0;
    int Ans=1001;
for (int i=0;i<Ss.length-Ts.length+1 ;i++){
  for (int j=0;j<Ts.length ;j++) {
     if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     }
  }
  if(Ans>Sum){
    Ans=Sum;
  }
  Sum=0;

}
System.out.println(Ans);
}
}
