
// Submitted by Subhash
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
	

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String s=sc.next(),t=sc.next();
		char c1[]=s.toCharArray();
		
		char c2[]=t.toCharArray();
		int n=c1.length,m=c2.length;
		int max=0;
		
		for(int i=0;i<m;i++) {
			for(int j=i;j<n&&n-j>=m-i;j++) {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			}
		}
		
		System.out.println(m-max);
		
		
	}

	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 nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] readLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.math.BigDecimal; BigDecimal java.math import java.math.BigInteger; BigInteger java.math import java.util.*; util.* java public class Main {
	

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String s=sc.next(),t=sc.next();
		char c1[]=s.toCharArray();
		
		char c2[]=t.toCharArray();
		int n=c1.length,m=c2.length;
		int max=0;
		
		for(int i=0;i<m;i++) {
			for(int j=i;j<n&&n-j>=m-i;j++) {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			}
		}
		
		System.out.println(m-max);
		
		
	}

	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 nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] readLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

} Main public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String s=sc.next(),t=sc.next();
		char c1[]=s.toCharArray();
		
		char c2[]=t.toCharArray();
		int n=c1.length,m=c2.length;
		int max=0;
		
		for(int i=0;i<m;i++) {
			for(int j=i;j<n&&n-j>=m-i;j++) {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			}
		}
		
		System.out.println(m-max);
		
		
	} main {
		FastScanner sc = new FastScanner();
		String s=sc.next(),t=sc.next();
		char c1[]=s.toCharArray();
		
		char c2[]=t.toCharArray();
		int n=c1.length,m=c2.length;
		int max=0;
		
		for(int i=0;i<m;i++) {
			for(int j=i;j<n&&n-j>=m-i;j++) {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			}
		}
		
		System.out.println(m-max);
		
		
	} FastScanner sc = new FastScanner(); sc new FastScanner() String s=sc.next() s sc.next() sc.next sc t=sc.next(); t sc.next() sc.next sc char c1[]=s.toCharArray(); c1 s.toCharArray() s.toCharArray s char c2[]=t.toCharArray(); c2 t.toCharArray() t.toCharArray t int n=c1.length n c1.length c1 c1.length m=c2.length; m c2.length c2 c2.length int max=0; max 0 for(int i=0;i<m;i++) {
			for(int j=i;j<n&&n-j>=m-i;j++) {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			}
		} int i=0; int i=0; i 0 i<m i m i++ i++ i {
			for(int j=i;j<n&&n-j>=m-i;j++) {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			}
		} {
			for(int j=i;j<n&&n-j>=m-i;j++) {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			}
		} for(int j=i;j<n&&n-j>=m-i;j++) {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			} int j=i; int j=i; j i j<n&&n-j>=m-i j<n j n n-j>=m-i n-j n j m-i m i j++ j++ j {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			} {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			} if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				} c2[i]==c1[j] c2[i] c2 i c1[j] c1 j {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				} int c=0; c 0 int k=0; k 0 for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					} int i1=j-i; int i1=j-i; i1 j-i j i i1<j-i+m i1 j-i+m j-i j i m i1++ i1++ i1 {
						if(c2[k++]==c1[i1]) c++;
					} {
						if(c2[k++]==c1[i1]) c++;
					} if(c2[k++]==c1[i1]) c++; c2[k++]==c1[i1] c2[k++] c2 k++ k c1[i1] c1 i1 c++ c max=Math.max(max, c) max Math.max(max, c) Math.max Math max c System.out.println(m-max) System.out.println System.out System System.out m-max m max String[] args args 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 nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] readLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		long nextLong() {
			return Long.parseLong(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 nextInt() {
			return Integer.parseInt(next());
		} nextInt {
			return Integer.parseInt(next());
		} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next 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 long[] readLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		} readLongArray {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		} long[] a = new long[n]; a new long[n] n for (int i = 0; i < n; i++)
				a[i] = nextLong(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = nextLong(); a[i] = nextLong() a[i] a i nextLong() nextLong return a; a int n n long nextLong() {
			return Long.parseLong(next());
		} nextLong {
			return Long.parseLong(next());
		} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public class Main {
	

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String s=sc.next(),t=sc.next();
		char c1[]=s.toCharArray();
		
		char c2[]=t.toCharArray();
		int n=c1.length,m=c2.length;
		int max=0;
		
		for(int i=0;i<m;i++) {
			for(int j=i;j<n&&n-j>=m-i;j++) {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			}
		}
		
		System.out.println(m-max);
		
		
	}

	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 nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] readLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

} public class Main {
	

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String s=sc.next(),t=sc.next();
		char c1[]=s.toCharArray();
		
		char c2[]=t.toCharArray();
		int n=c1.length,m=c2.length;
		int max=0;
		
		for(int i=0;i<m;i++) {
			for(int j=i;j<n&&n-j>=m-i;j++) {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			}
		}
		
		System.out.println(m-max);
		
		
	}

	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 nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] readLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

} Main

// Submitted by Subhash
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
	

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String s=sc.next(),t=sc.next();
		char c1[]=s.toCharArray();
		
		char c2[]=t.toCharArray();
		int n=c1.length,m=c2.length;
		int max=0;
		
		for(int i=0;i<m;i++) {
			for(int j=i;j<n&&n-j>=m-i;j++) {
				
				if(c2[i]==c1[j]) {
					
					int c=0;
					int k=0;
					
					for(int i1=j-i;i1<j-i+m;i1++) {
						if(c2[k++]==c1[i1]) c++;
					}
					
					max=Math.max(max, c);
				}
				
			}
		}
		
		System.out.println(m-max);
		
		
	}

	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 nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] readLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

}