import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String T = in.next();
		int a = 0;
		int b = 10000;

		String[] SArray = S.split("");
		String[] TArray = T.split("");

		for(int i=0; i<SArray.length - TArray.length + 1; i++) {
			for(int j=0; j<TArray.length; j++) {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			}
			if(a < b) {
				b = a;
			}
			a = 0;
		}

		System.out.println(b);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String T = in.next();
		int a = 0;
		int b = 10000;

		String[] SArray = S.split("");
		String[] TArray = T.split("");

		for(int i=0; i<SArray.length - TArray.length + 1; i++) {
			for(int j=0; j<TArray.length; j++) {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			}
			if(a < b) {
				b = a;
			}
			a = 0;
		}

		System.out.println(b);
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String T = in.next();
		int a = 0;
		int b = 10000;

		String[] SArray = S.split("");
		String[] TArray = T.split("");

		for(int i=0; i<SArray.length - TArray.length + 1; i++) {
			for(int j=0; j<TArray.length; j++) {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			}
			if(a < b) {
				b = a;
			}
			a = 0;
		}

		System.out.println(b);
	} main {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String T = in.next();
		int a = 0;
		int b = 10000;

		String[] SArray = S.split("");
		String[] TArray = T.split("");

		for(int i=0; i<SArray.length - TArray.length + 1; i++) {
			for(int j=0; j<TArray.length; j++) {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			}
			if(a < b) {
				b = a;
			}
			a = 0;
		}

		System.out.println(b);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) String S = in.next(); S in.next() in.next in String T = in.next(); T in.next() in.next in int a = 0; a 0 int b = 10000; b 10000 String[] SArray = S.split(""); SArray S.split("") S.split S "" String[] TArray = T.split(""); TArray T.split("") T.split T "" for(int i=0; i<SArray.length - TArray.length + 1; i++) {
			for(int j=0; j<TArray.length; j++) {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			}
			if(a < b) {
				b = a;
			}
			a = 0;
		} int i=0; int i=0; i 0 i<SArray.length - TArray.length + 1 i SArray.length - TArray.length + 1 SArray.length - TArray.length SArray.length SArray SArray.length TArray.length TArray TArray.length 1 i++ i++ i {
			for(int j=0; j<TArray.length; j++) {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			}
			if(a < b) {
				b = a;
			}
			a = 0;
		} {
			for(int j=0; j<TArray.length; j++) {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			}
			if(a < b) {
				b = a;
			}
			a = 0;
		} for(int j=0; j<TArray.length; j++) {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			} int j=0; int j=0; j 0 j<TArray.length j TArray.length TArray TArray.length j++ j++ j {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			} {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			} if(!SArray[j+i].equals(TArray[j])) {
					a++;
				} !SArray[j+i].equals(TArray[j]) SArray[j+i].equals(TArray[j]) SArray[j+i].equals SArray[j+i] SArray j+i j i TArray[j] TArray j {
					a++;
				} a++ a if(a < b) {
				b = a;
			} a < b a b {
				b = a;
			} b = a b a a = 0 a 0 System.out.println(b) System.out.println System.out System System.out b String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String T = in.next();
		int a = 0;
		int b = 10000;

		String[] SArray = S.split("");
		String[] TArray = T.split("");

		for(int i=0; i<SArray.length - TArray.length + 1; i++) {
			for(int j=0; j<TArray.length; j++) {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			}
			if(a < b) {
				b = a;
			}
			a = 0;
		}

		System.out.println(b);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String T = in.next();
		int a = 0;
		int b = 10000;

		String[] SArray = S.split("");
		String[] TArray = T.split("");

		for(int i=0; i<SArray.length - TArray.length + 1; i++) {
			for(int j=0; j<TArray.length; j++) {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			}
			if(a < b) {
				b = a;
			}
			a = 0;
		}

		System.out.println(b);
	}
} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String T = in.next();
		int a = 0;
		int b = 10000;

		String[] SArray = S.split("");
		String[] TArray = T.split("");

		for(int i=0; i<SArray.length - TArray.length + 1; i++) {
			for(int j=0; j<TArray.length; j++) {
				if(!SArray[j+i].equals(TArray[j])) {
					a++;
				}
			}
			if(a < b) {
				b = a;
			}
			a = 0;
		}

		System.out.println(b);
	}
}
