import 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[] pin = new int[s.length()];

	if(s.contains(t)) System.out.println(0);
	else {
	    for(int i=0; i<t.length(); i++){
		for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		}		
	    }
	    int max=0;
	    for(int i=0; i<s.length(); i++){
		if(pin[i]>max){
		    max=pin[i];
		}
	    }		
	    System.out.println(t.length()-max);
	}
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	String t = sc.next();
	int[] pin = new int[s.length()];

	if(s.contains(t)) System.out.println(0);
	else {
	    for(int i=0; i<t.length(); i++){
		for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		}		
	    }
	    int max=0;
	    for(int i=0; i<s.length(); i++){
		if(pin[i]>max){
		    max=pin[i];
		}
	    }		
	    System.out.println(t.length()-max);
	}
    }
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	String t = sc.next();
	int[] pin = new int[s.length()];

	if(s.contains(t)) System.out.println(0);
	else {
	    for(int i=0; i<t.length(); i++){
		for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		}		
	    }
	    int max=0;
	    for(int i=0; i<s.length(); i++){
		if(pin[i]>max){
		    max=pin[i];
		}
	    }		
	    System.out.println(t.length()-max);
	}
    } main {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	String t = sc.next();
	int[] pin = new int[s.length()];

	if(s.contains(t)) System.out.println(0);
	else {
	    for(int i=0; i<t.length(); i++){
		for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		}		
	    }
	    int max=0;
	    for(int i=0; i<s.length(); i++){
		if(pin[i]>max){
		    max=pin[i];
		}
	    }		
	    System.out.println(t.length()-max);
	}
    } 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[] pin = new int[s.length()]; pin new int[s.length()] s.length() s.length s if(s.contains(t)) System.out.println(0);
	else {
	    for(int i=0; i<t.length(); i++){
		for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		}		
	    }
	    int max=0;
	    for(int i=0; i<s.length(); i++){
		if(pin[i]>max){
		    max=pin[i];
		}
	    }		
	    System.out.println(t.length()-max);
	} s.contains(t) s.contains s t System.out.println(0) System.out.println System.out System System.out 0 {
	    for(int i=0; i<t.length(); i++){
		for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		}		
	    }
	    int max=0;
	    for(int i=0; i<s.length(); i++){
		if(pin[i]>max){
		    max=pin[i];
		}
	    }		
	    System.out.println(t.length()-max);
	} for(int i=0; i<t.length(); i++){
		for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		}		
	    } int i=0; int i=0; i 0 i<t.length() i t.length() t.length t i++ i++ i {
		for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		}		
	    } {
		for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		}		
	    } for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		} int i2=i; int i2=i; i2 i i2<s.length()-t.length()+i+1 i2 s.length()-t.length()+i+1 s.length()-t.length()+i+1 s.length()-t.length() s.length() s.length s t.length() t.length t i 1 i2++ i2++ i2 {
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		} {
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		} t=t+" " t t+" " t " " s=s+" " s s+" " s " " if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++; s.substring(i2,i2+1).equals(t.substring(i, i+1)) s.substring(i2,i2+1).equals s.substring(i2,i2+1) s.substring s i2 i2+1 i2 1 t.substring(i, i+1) t.substring t i i+1 i 1 pin[i2-i]++ pin[i2-i] pin i2-i i2 i t=t.trim() t t.trim() t.trim t s=s.trim() s s.trim() s.trim s int max=0; max 0 for(int i=0; i<s.length(); i++){
		if(pin[i]>max){
		    max=pin[i];
		}
	    } int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
		if(pin[i]>max){
		    max=pin[i];
		}
	    } {
		if(pin[i]>max){
		    max=pin[i];
		}
	    } if(pin[i]>max){
		    max=pin[i];
		} pin[i]>max pin[i] pin i max {
		    max=pin[i];
		} max=pin[i] max pin[i] pin i System.out.println(t.length()-max) System.out.println System.out System System.out t.length()-max t.length() t.length t max 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[] pin = new int[s.length()];

	if(s.contains(t)) System.out.println(0);
	else {
	    for(int i=0; i<t.length(); i++){
		for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		}		
	    }
	    int max=0;
	    for(int i=0; i<s.length(); i++){
		if(pin[i]>max){
		    max=pin[i];
		}
	    }		
	    System.out.println(t.length()-max);
	}
    }
} public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	String t = sc.next();
	int[] pin = new int[s.length()];

	if(s.contains(t)) System.out.println(0);
	else {
	    for(int i=0; i<t.length(); i++){
		for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		}		
	    }
	    int max=0;
	    for(int i=0; i<s.length(); i++){
		if(pin[i]>max){
		    max=pin[i];
		}
	    }		
	    System.out.println(t.length()-max);
	}
    }
} Main
import 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[] pin = new int[s.length()];

	if(s.contains(t)) System.out.println(0);
	else {
	    for(int i=0; i<t.length(); i++){
		for(int i2=i; i2<s.length()-t.length()+i+1; i2++){
		    t=t+" ";
		    s=s+" ";
		    if(s.substring(i2,i2+1).equals(t.substring(i, i+1)))pin[i2-i]++;
		    t=t.trim();
		    s=s.trim();
		}		
	    }
	    int max=0;
	    for(int i=0; i<s.length(); i++){
		if(pin[i]>max){
		    max=pin[i];
		}
	    }		
	    System.out.println(t.length()-max);
	}
    }
}
