import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main
{
	private static void solve(FastScanner fr) {
		char[] s = fr.next().toCharArray();
		char[] t = fr.next().toCharArray();

		int min = t.length;
		for(int i=0; i<=s.length - t.length; i++) {
			int lmin = 0;
			for(int j=0; j<t.length; j++){
				if(s[i+j]!=t[j])	lmin++;
			}
			min = Math.min(min, lmin);
		}
		sout(min);
	}
    public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int n = 1;
		// int n = fs.nextInt();
		while (n-- > 0)	{
			solve(fs);
        }
    }

    private static void sout()          { System.out.println();  }
    private static void sout(String s)  { System.out.println(s); }
    private static void sout(int s)     { System.out.println(s); }
    private static void sout(long s)    { System.out.println(s); }
    private static void sout(double s)  { System.out.println(s); }
    
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); }
			return st.nextToken();
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		int nextInt() {	return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.*; util.* java public class Main
{
	private static void solve(FastScanner fr) {
		char[] s = fr.next().toCharArray();
		char[] t = fr.next().toCharArray();

		int min = t.length;
		for(int i=0; i<=s.length - t.length; i++) {
			int lmin = 0;
			for(int j=0; j<t.length; j++){
				if(s[i+j]!=t[j])	lmin++;
			}
			min = Math.min(min, lmin);
		}
		sout(min);
	}
    public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int n = 1;
		// int n = fs.nextInt();
		while (n-- > 0)	{
			solve(fs);
        }
    }

    private static void sout()          { System.out.println();  }
    private static void sout(String s)  { System.out.println(s); }
    private static void sout(int s)     { System.out.println(s); }
    private static void sout(long s)    { System.out.println(s); }
    private static void sout(double s)  { System.out.println(s); }
    
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); }
			return st.nextToken();
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		int nextInt() {	return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
} Main private static void solve(FastScanner fr) {
		char[] s = fr.next().toCharArray();
		char[] t = fr.next().toCharArray();

		int min = t.length;
		for(int i=0; i<=s.length - t.length; i++) {
			int lmin = 0;
			for(int j=0; j<t.length; j++){
				if(s[i+j]!=t[j])	lmin++;
			}
			min = Math.min(min, lmin);
		}
		sout(min);
	} solve {
		char[] s = fr.next().toCharArray();
		char[] t = fr.next().toCharArray();

		int min = t.length;
		for(int i=0; i<=s.length - t.length; i++) {
			int lmin = 0;
			for(int j=0; j<t.length; j++){
				if(s[i+j]!=t[j])	lmin++;
			}
			min = Math.min(min, lmin);
		}
		sout(min);
	} char[] s = fr.next().toCharArray(); s fr.next().toCharArray() fr.next().toCharArray fr.next() fr.next fr char[] t = fr.next().toCharArray(); t fr.next().toCharArray() fr.next().toCharArray fr.next() fr.next fr int min = t.length; min t.length t t.length for(int i=0; i<=s.length - t.length; i++) {
			int lmin = 0;
			for(int j=0; j<t.length; j++){
				if(s[i+j]!=t[j])	lmin++;
			}
			min = Math.min(min, lmin);
		} int i=0; int i=0; i 0 i<=s.length - t.length i s.length - t.length s.length s s.length t.length t t.length i++ i++ i {
			int lmin = 0;
			for(int j=0; j<t.length; j++){
				if(s[i+j]!=t[j])	lmin++;
			}
			min = Math.min(min, lmin);
		} {
			int lmin = 0;
			for(int j=0; j<t.length; j++){
				if(s[i+j]!=t[j])	lmin++;
			}
			min = Math.min(min, lmin);
		} int lmin = 0; lmin 0 for(int j=0; j<t.length; j++){
				if(s[i+j]!=t[j])	lmin++;
			} 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])	lmin++;
			} {
				if(s[i+j]!=t[j])	lmin++;
			} if(s[i+j]!=t[j])	lmin++; s[i+j]!=t[j] s[i+j] s i+j i j t[j] t j lmin++ lmin min = Math.min(min, lmin) min Math.min(min, lmin) Math.min Math min lmin sout(min) sout min FastScanner fr fr public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int n = 1;
		// int n = fs.nextInt();
		while (n-- > 0)	{
			solve(fs);
        }
    } main {
		FastScanner fs = new FastScanner();
		int n = 1;
		// int n = fs.nextInt();
		while (n-- > 0)	{
			solve(fs);
        }
    } FastScanner fs = new FastScanner(); fs new FastScanner() int n = 1; n 1 while (n-- > 0)	{
			solve(fs);
        } n-- > 0 n-- n 0 {
			solve(fs);
        } solve(fs) solve fs String[] args args private static void sout()          { System.out.println();  } sout { System.out.println();  } System.out.println() System.out.println System.out System System.out private static void sout(String s)  { System.out.println(s); } sout { System.out.println(s); } System.out.println(s) System.out.println System.out System System.out s String s s private static void sout(int s)     { System.out.println(s); } sout { System.out.println(s); } System.out.println(s) System.out.println System.out System System.out s int s s private static void sout(long s)    { System.out.println(s); } sout { System.out.println(s); } System.out.println(s) System.out.println System.out System System.out s long s s private static void sout(double s)  { System.out.println(s); } sout { System.out.println(s); } System.out.println(s) System.out.println System.out System System.out s double s s static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); }
			return st.nextToken();
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		int nextInt() {	return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	} FastScanner BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st=new StringTokenizer(""); st new StringTokenizer("") String next() {
			while (!st.hasMoreTokens())
				try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); }
			return st.nextToken();
		} next {
			while (!st.hasMoreTokens())
				try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); }
			return st.nextToken();
		} while (!st.hasMoreTokens())
				try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } IOException e { e.printStackTrace(); } e.printStackTrace() e.printStackTrace e { st=new StringTokenizer(br.readLine()); } st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		} readArray {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		} int[] a=new int[n]; a new int[n] n for (int i=0; i<n; i++) a[i]=nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i a[i]=nextInt(); a[i]=nextInt() a[i] a i nextInt() nextInt return a; a int n n int nextInt() {	return Integer.parseInt(next()); } nextInt {	return Integer.parseInt(next()); } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() { return Long.parseLong(next()); } nextLong { return Long.parseLong(next()); } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble() { return Double.parseDouble(next()); } nextDouble { return Double.parseDouble(next()); } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public class Main
{
	private static void solve(FastScanner fr) {
		char[] s = fr.next().toCharArray();
		char[] t = fr.next().toCharArray();

		int min = t.length;
		for(int i=0; i<=s.length - t.length; i++) {
			int lmin = 0;
			for(int j=0; j<t.length; j++){
				if(s[i+j]!=t[j])	lmin++;
			}
			min = Math.min(min, lmin);
		}
		sout(min);
	}
    public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int n = 1;
		// int n = fs.nextInt();
		while (n-- > 0)	{
			solve(fs);
        }
    }

    private static void sout()          { System.out.println();  }
    private static void sout(String s)  { System.out.println(s); }
    private static void sout(int s)     { System.out.println(s); }
    private static void sout(long s)    { System.out.println(s); }
    private static void sout(double s)  { System.out.println(s); }
    
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); }
			return st.nextToken();
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		int nextInt() {	return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
} public class Main
{
	private static void solve(FastScanner fr) {
		char[] s = fr.next().toCharArray();
		char[] t = fr.next().toCharArray();

		int min = t.length;
		for(int i=0; i<=s.length - t.length; i++) {
			int lmin = 0;
			for(int j=0; j<t.length; j++){
				if(s[i+j]!=t[j])	lmin++;
			}
			min = Math.min(min, lmin);
		}
		sout(min);
	}
    public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int n = 1;
		// int n = fs.nextInt();
		while (n-- > 0)	{
			solve(fs);
        }
    }

    private static void sout()          { System.out.println();  }
    private static void sout(String s)  { System.out.println(s); }
    private static void sout(int s)     { System.out.println(s); }
    private static void sout(long s)    { System.out.println(s); }
    private static void sout(double s)  { System.out.println(s); }
    
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); }
			return st.nextToken();
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		int nextInt() {	return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main
{
	private static void solve(FastScanner fr) {
		char[] s = fr.next().toCharArray();
		char[] t = fr.next().toCharArray();

		int min = t.length;
		for(int i=0; i<=s.length - t.length; i++) {
			int lmin = 0;
			for(int j=0; j<t.length; j++){
				if(s[i+j]!=t[j])	lmin++;
			}
			min = Math.min(min, lmin);
		}
		sout(min);
	}
    public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int n = 1;
		// int n = fs.nextInt();
		while (n-- > 0)	{
			solve(fs);
        }
    }

    private static void sout()          { System.out.println();  }
    private static void sout(String s)  { System.out.println(s); }
    private static void sout(int s)     { System.out.println(s); }
    private static void sout(long s)    { System.out.println(s); }
    private static void sout(double s)  { System.out.println(s); }
    
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); }
			return st.nextToken();
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		int nextInt() {	return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
}
