import java.util.ArrayList;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();

		int Slength = S.length();
		int Tlength = T.length();

		ArrayList<String> SstrArray = new ArrayList<String>();

		for (int i = 0; i <= (Slength - Tlength); i++) {
			String Sstr = S.substring(i, Tlength + i);
			SstrArray.add(Sstr);
		}


		String[] Tarray = T.split("");
		int count = 0;
		int[] countArray = new int[SstrArray.size()];


		for (int j = 0; j < SstrArray.size(); j++) {
			String[] SstrArray2 = SstrArray.get(j).split("");
			for (int k = 0; k < Tarray.length; k++) {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			}
			countArray[j] = count;
			count = 0;
		}

		int countMin = countArray[0];
		for(int m = 0; m < countArray.length; m++) {
			if(countMin > countArray[m]) {
				countMin = countArray[m];
			}
		}

		System.out.println(countMin);

	}

} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();

		int Slength = S.length();
		int Tlength = T.length();

		ArrayList<String> SstrArray = new ArrayList<String>();

		for (int i = 0; i <= (Slength - Tlength); i++) {
			String Sstr = S.substring(i, Tlength + i);
			SstrArray.add(Sstr);
		}


		String[] Tarray = T.split("");
		int count = 0;
		int[] countArray = new int[SstrArray.size()];


		for (int j = 0; j < SstrArray.size(); j++) {
			String[] SstrArray2 = SstrArray.get(j).split("");
			for (int k = 0; k < Tarray.length; k++) {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			}
			countArray[j] = count;
			count = 0;
		}

		int countMin = countArray[0];
		for(int m = 0; m < countArray.length; m++) {
			if(countMin > countArray[m]) {
				countMin = countArray[m];
			}
		}

		System.out.println(countMin);

	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();

		int Slength = S.length();
		int Tlength = T.length();

		ArrayList<String> SstrArray = new ArrayList<String>();

		for (int i = 0; i <= (Slength - Tlength); i++) {
			String Sstr = S.substring(i, Tlength + i);
			SstrArray.add(Sstr);
		}


		String[] Tarray = T.split("");
		int count = 0;
		int[] countArray = new int[SstrArray.size()];


		for (int j = 0; j < SstrArray.size(); j++) {
			String[] SstrArray2 = SstrArray.get(j).split("");
			for (int k = 0; k < Tarray.length; k++) {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			}
			countArray[j] = count;
			count = 0;
		}

		int countMin = countArray[0];
		for(int m = 0; m < countArray.length; m++) {
			if(countMin > countArray[m]) {
				countMin = countArray[m];
			}
		}

		System.out.println(countMin);

	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();

		int Slength = S.length();
		int Tlength = T.length();

		ArrayList<String> SstrArray = new ArrayList<String>();

		for (int i = 0; i <= (Slength - Tlength); i++) {
			String Sstr = S.substring(i, Tlength + i);
			SstrArray.add(Sstr);
		}


		String[] Tarray = T.split("");
		int count = 0;
		int[] countArray = new int[SstrArray.size()];


		for (int j = 0; j < SstrArray.size(); j++) {
			String[] SstrArray2 = SstrArray.get(j).split("");
			for (int k = 0; k < Tarray.length; k++) {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			}
			countArray[j] = count;
			count = 0;
		}

		int countMin = countArray[0];
		for(int m = 0; m < countArray.length; m++) {
			if(countMin > countArray[m]) {
				countMin = countArray[m];
			}
		}

		System.out.println(countMin);

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan String T = scan.next(); T scan.next() scan.next scan scan.close() scan.close scan int Slength = S.length(); Slength S.length() S.length S int Tlength = T.length(); Tlength T.length() T.length T ArrayList<String> SstrArray = new ArrayList<String>(); SstrArray new ArrayList<String>() for (int i = 0; i <= (Slength - Tlength); i++) {
			String Sstr = S.substring(i, Tlength + i);
			SstrArray.add(Sstr);
		} int i = 0; int i = 0; i 0 i <= (Slength - Tlength) i (Slength - Tlength) Slength Tlength i++ i++ i {
			String Sstr = S.substring(i, Tlength + i);
			SstrArray.add(Sstr);
		} {
			String Sstr = S.substring(i, Tlength + i);
			SstrArray.add(Sstr);
		} String Sstr = S.substring(i, Tlength + i); Sstr S.substring(i, Tlength + i) S.substring S i Tlength + i Tlength i SstrArray.add(Sstr) SstrArray.add SstrArray Sstr String[] Tarray = T.split(""); Tarray T.split("") T.split T "" int count = 0; count 0 int[] countArray = new int[SstrArray.size()]; countArray new int[SstrArray.size()] SstrArray.size() SstrArray.size SstrArray for (int j = 0; j < SstrArray.size(); j++) {
			String[] SstrArray2 = SstrArray.get(j).split("");
			for (int k = 0; k < Tarray.length; k++) {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			}
			countArray[j] = count;
			count = 0;
		} int j = 0; int j = 0; j 0 j < SstrArray.size() j SstrArray.size() SstrArray.size SstrArray j++ j++ j {
			String[] SstrArray2 = SstrArray.get(j).split("");
			for (int k = 0; k < Tarray.length; k++) {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			}
			countArray[j] = count;
			count = 0;
		} {
			String[] SstrArray2 = SstrArray.get(j).split("");
			for (int k = 0; k < Tarray.length; k++) {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			}
			countArray[j] = count;
			count = 0;
		} String[] SstrArray2 = SstrArray.get(j).split(""); SstrArray2 SstrArray.get(j).split("") SstrArray.get(j).split SstrArray.get(j) SstrArray.get SstrArray j "" for (int k = 0; k < Tarray.length; k++) {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			} int k = 0; int k = 0; k 0 k < Tarray.length k Tarray.length Tarray Tarray.length k++ k++ k {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			} {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			} if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				} !(Tarray[k].equals(SstrArray2[k])) (Tarray[k].equals(SstrArray2[k])) Tarray[k].equals Tarray[k] Tarray k SstrArray2[k] SstrArray2 k {
					count = count + 1;
				} count = count + 1 count count + 1 count 1 countArray[j] = count countArray[j] countArray j count count = 0 count 0 int countMin = countArray[0]; countMin countArray[0] countArray 0 for(int m = 0; m < countArray.length; m++) {
			if(countMin > countArray[m]) {
				countMin = countArray[m];
			}
		} int m = 0; int m = 0; m 0 m < countArray.length m countArray.length countArray countArray.length m++ m++ m {
			if(countMin > countArray[m]) {
				countMin = countArray[m];
			}
		} {
			if(countMin > countArray[m]) {
				countMin = countArray[m];
			}
		} if(countMin > countArray[m]) {
				countMin = countArray[m];
			} countMin > countArray[m] countMin countArray[m] countArray m {
				countMin = countArray[m];
			} countMin = countArray[m] countMin countArray[m] countArray m System.out.println(countMin) System.out.println System.out System System.out countMin String[] args args public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();

		int Slength = S.length();
		int Tlength = T.length();

		ArrayList<String> SstrArray = new ArrayList<String>();

		for (int i = 0; i <= (Slength - Tlength); i++) {
			String Sstr = S.substring(i, Tlength + i);
			SstrArray.add(Sstr);
		}


		String[] Tarray = T.split("");
		int count = 0;
		int[] countArray = new int[SstrArray.size()];


		for (int j = 0; j < SstrArray.size(); j++) {
			String[] SstrArray2 = SstrArray.get(j).split("");
			for (int k = 0; k < Tarray.length; k++) {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			}
			countArray[j] = count;
			count = 0;
		}

		int countMin = countArray[0];
		for(int m = 0; m < countArray.length; m++) {
			if(countMin > countArray[m]) {
				countMin = countArray[m];
			}
		}

		System.out.println(countMin);

	}

} public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();

		int Slength = S.length();
		int Tlength = T.length();

		ArrayList<String> SstrArray = new ArrayList<String>();

		for (int i = 0; i <= (Slength - Tlength); i++) {
			String Sstr = S.substring(i, Tlength + i);
			SstrArray.add(Sstr);
		}


		String[] Tarray = T.split("");
		int count = 0;
		int[] countArray = new int[SstrArray.size()];


		for (int j = 0; j < SstrArray.size(); j++) {
			String[] SstrArray2 = SstrArray.get(j).split("");
			for (int k = 0; k < Tarray.length; k++) {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			}
			countArray[j] = count;
			count = 0;
		}

		int countMin = countArray[0];
		for(int m = 0; m < countArray.length; m++) {
			if(countMin > countArray[m]) {
				countMin = countArray[m];
			}
		}

		System.out.println(countMin);

	}

} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();

		int Slength = S.length();
		int Tlength = T.length();

		ArrayList<String> SstrArray = new ArrayList<String>();

		for (int i = 0; i <= (Slength - Tlength); i++) {
			String Sstr = S.substring(i, Tlength + i);
			SstrArray.add(Sstr);
		}


		String[] Tarray = T.split("");
		int count = 0;
		int[] countArray = new int[SstrArray.size()];


		for (int j = 0; j < SstrArray.size(); j++) {
			String[] SstrArray2 = SstrArray.get(j).split("");
			for (int k = 0; k < Tarray.length; k++) {
				if (!(Tarray[k].equals(SstrArray2[k]))) {
					count = count + 1;
				}
			}
			countArray[j] = count;
			count = 0;
		}

		int countMin = countArray[0];
		for(int m = 0; m < countArray.length; m++) {
			if(countMin > countArray[m]) {
				countMin = countArray[m];
			}
		}

		System.out.println(countMin);

	}

}
