
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {
  
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastInput in = new FastInput(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Sample solver = new Sample();
		solver.solve(1, in, out);
		out.close();
	}
	
	static class Sample {
	
		public void solve(int testNum, FastInput in, PrintWriter out) {
			
			String s = in.next();
			String t = in.next();
			
			int n = s.length();
			int m = t.length();
			
			int min = m;
			for(int i = 0 ; i < n - m + 1  ;i++) {
				int tmp = 0;
				for(int j = 0 ; j < m ; j++) {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				}
				min = Math.min(tmp,min);
			}
			
			out.println(min);
			
	
		}
	
	}
	static class FastInput{
		private final BufferedReader in;
		private String[] buff;
		private int index = 0;
		
		public FastInput(InputStream is) {
			in = new BufferedReader(new InputStreamReader(is));
		}
		String nextLine() {
			try {
				return in.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		}
		String next() {
			while (buff == null || index >= buff.length) {
				buff = nextLine().split(" ");
				index = 0;
			}
			return buff[index++];
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		Double nextDouble() {
			return Double.parseDouble(next());
		}
		
		BigInteger nextBigInteger() {
			return new BigInteger(next());
		}
		
		BigDecimal nextBigDecimal() {
			return new BigDecimal(next());
		}
		
		public int[] nextIntArray(final int n) {
			final int[] res = new int [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextInt();
			}
			return res;
		}
		
		public long[] nextLongArray(final int n) {
			final long[] res= new long [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextLong();
			}
			return res;
		}
		
		public double[] nextDoubleArray(final int n ) {
			final double[] res = new double [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextDouble();
			}
			return res;
		}
		
		
		public int[][] nextInt2DArray(final int n , final int m){
			int [][]res = new int [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				}
			}
			return res;
		}
		public long[][] nextLong2DArray(final int n , final int m){
			long [][]res = new long [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				}
			}
			return res;
		}
		
		public char[][] nextChar2DArray(final int n){
			char [][]res = new char [n][];
			
			for(int i = 0 ; i < n ;i++) {
				String s = next();
				res[i] = s.toCharArray();
			}
			
			return res;
		}
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.OutputStream; OutputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.math.BigDecimal; BigDecimal java.math import java.math.BigInteger; BigInteger java.math public class Main {
  
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastInput in = new FastInput(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Sample solver = new Sample();
		solver.solve(1, in, out);
		out.close();
	}
	
	static class Sample {
	
		public void solve(int testNum, FastInput in, PrintWriter out) {
			
			String s = in.next();
			String t = in.next();
			
			int n = s.length();
			int m = t.length();
			
			int min = m;
			for(int i = 0 ; i < n - m + 1  ;i++) {
				int tmp = 0;
				for(int j = 0 ; j < m ; j++) {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				}
				min = Math.min(tmp,min);
			}
			
			out.println(min);
			
	
		}
	
	}
	static class FastInput{
		private final BufferedReader in;
		private String[] buff;
		private int index = 0;
		
		public FastInput(InputStream is) {
			in = new BufferedReader(new InputStreamReader(is));
		}
		String nextLine() {
			try {
				return in.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		}
		String next() {
			while (buff == null || index >= buff.length) {
				buff = nextLine().split(" ");
				index = 0;
			}
			return buff[index++];
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		Double nextDouble() {
			return Double.parseDouble(next());
		}
		
		BigInteger nextBigInteger() {
			return new BigInteger(next());
		}
		
		BigDecimal nextBigDecimal() {
			return new BigDecimal(next());
		}
		
		public int[] nextIntArray(final int n) {
			final int[] res = new int [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextInt();
			}
			return res;
		}
		
		public long[] nextLongArray(final int n) {
			final long[] res= new long [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextLong();
			}
			return res;
		}
		
		public double[] nextDoubleArray(final int n ) {
			final double[] res = new double [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextDouble();
			}
			return res;
		}
		
		
		public int[][] nextInt2DArray(final int n , final int m){
			int [][]res = new int [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				}
			}
			return res;
		}
		public long[][] nextLong2DArray(final int n , final int m){
			long [][]res = new long [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				}
			}
			return res;
		}
		
		public char[][] nextChar2DArray(final int n){
			char [][]res = new char [n][];
			
			for(int i = 0 ; i < n ;i++) {
				String s = next();
				res[i] = s.toCharArray();
			}
			
			return res;
		}
	}

} Main public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastInput in = new FastInput(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Sample solver = new Sample();
		solver.solve(1, in, out);
		out.close();
	} main {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastInput in = new FastInput(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Sample solver = new Sample();
		solver.solve(1, in, out);
		out.close();
	} InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out FastInput in = new FastInput(inputStream); in new FastInput(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) Sample solver = new Sample(); solver new Sample() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class Sample {
	
		public void solve(int testNum, FastInput in, PrintWriter out) {
			
			String s = in.next();
			String t = in.next();
			
			int n = s.length();
			int m = t.length();
			
			int min = m;
			for(int i = 0 ; i < n - m + 1  ;i++) {
				int tmp = 0;
				for(int j = 0 ; j < m ; j++) {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				}
				min = Math.min(tmp,min);
			}
			
			out.println(min);
			
	
		}
	
	} Sample public void solve(int testNum, FastInput in, PrintWriter out) {
			
			String s = in.next();
			String t = in.next();
			
			int n = s.length();
			int m = t.length();
			
			int min = m;
			for(int i = 0 ; i < n - m + 1  ;i++) {
				int tmp = 0;
				for(int j = 0 ; j < m ; j++) {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				}
				min = Math.min(tmp,min);
			}
			
			out.println(min);
			
	
		} solve {
			
			String s = in.next();
			String t = in.next();
			
			int n = s.length();
			int m = t.length();
			
			int min = m;
			for(int i = 0 ; i < n - m + 1  ;i++) {
				int tmp = 0;
				for(int j = 0 ; j < m ; j++) {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				}
				min = Math.min(tmp,min);
			}
			
			out.println(min);
			
	
		} String s = in.next(); s in.next() in.next in String t = in.next(); t in.next() in.next in int n = s.length(); n s.length() s.length s int m = t.length(); m t.length() t.length t int min = m; min m for(int i = 0 ; i < n - m + 1  ;i++) {
				int tmp = 0;
				for(int j = 0 ; j < m ; j++) {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				}
				min = Math.min(tmp,min);
			} int i = 0 ; int i = 0 ; i 0 i < n - m + 1 i n - m + 1 n - m n m 1 i++ i++ i {
				int tmp = 0;
				for(int j = 0 ; j < m ; j++) {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				}
				min = Math.min(tmp,min);
			} {
				int tmp = 0;
				for(int j = 0 ; j < m ; j++) {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				}
				min = Math.min(tmp,min);
			} int tmp = 0; tmp 0 for(int j = 0 ; j < m ; j++) {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				} int j = 0 ; int j = 0 ; j 0 j < m j m j++ j++ j {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				} {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				} if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					} s.charAt(i+j) != t.charAt(j) s.charAt(i+j) s.charAt s i+j i j t.charAt(j) t.charAt t j {
						tmp++;
					} tmp++ tmp min = Math.min(tmp,min) min Math.min(tmp,min) Math.min Math tmp min out.println(min) out.println out min int testNum testNum FastInput in in PrintWriter out out static class FastInput{
		private final BufferedReader in;
		private String[] buff;
		private int index = 0;
		
		public FastInput(InputStream is) {
			in = new BufferedReader(new InputStreamReader(is));
		}
		String nextLine() {
			try {
				return in.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		}
		String next() {
			while (buff == null || index >= buff.length) {
				buff = nextLine().split(" ");
				index = 0;
			}
			return buff[index++];
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		Double nextDouble() {
			return Double.parseDouble(next());
		}
		
		BigInteger nextBigInteger() {
			return new BigInteger(next());
		}
		
		BigDecimal nextBigDecimal() {
			return new BigDecimal(next());
		}
		
		public int[] nextIntArray(final int n) {
			final int[] res = new int [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextInt();
			}
			return res;
		}
		
		public long[] nextLongArray(final int n) {
			final long[] res= new long [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextLong();
			}
			return res;
		}
		
		public double[] nextDoubleArray(final int n ) {
			final double[] res = new double [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextDouble();
			}
			return res;
		}
		
		
		public int[][] nextInt2DArray(final int n , final int m){
			int [][]res = new int [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				}
			}
			return res;
		}
		public long[][] nextLong2DArray(final int n , final int m){
			long [][]res = new long [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				}
			}
			return res;
		}
		
		public char[][] nextChar2DArray(final int n){
			char [][]res = new char [n][];
			
			for(int i = 0 ; i < n ;i++) {
				String s = next();
				res[i] = s.toCharArray();
			}
			
			return res;
		}
	} FastInput private final BufferedReader in; in private String[] buff; buff private int index = 0; index 0 public FastInput(InputStream is) {
			in = new BufferedReader(new InputStreamReader(is));
		} FastInput {
			in = new BufferedReader(new InputStreamReader(is));
		} in = new BufferedReader(new InputStreamReader(is)) in new BufferedReader(new InputStreamReader(is)) InputStream is is String nextLine() {
			try {
				return in.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		} nextLine {
			try {
				return in.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		} try {
				return in.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			} IOException e {
				e.printStackTrace();
			} e.printStackTrace() e.printStackTrace e {
				return in.readLine();
			} return in.readLine(); in.readLine() in.readLine in return null; null String next() {
			while (buff == null || index >= buff.length) {
				buff = nextLine().split(" ");
				index = 0;
			}
			return buff[index++];
		} next {
			while (buff == null || index >= buff.length) {
				buff = nextLine().split(" ");
				index = 0;
			}
			return buff[index++];
		} while (buff == null || index >= buff.length) {
				buff = nextLine().split(" ");
				index = 0;
			} buff == null || index >= buff.length buff == null buff null index >= buff.length index buff.length buff buff.length {
				buff = nextLine().split(" ");
				index = 0;
			} buff = nextLine().split(" ") buff nextLine().split(" ") nextLine().split nextLine() nextLine " " index = 0 index 0 return buff[index++]; buff[index++] buff index++ index 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 BigInteger nextBigInteger() {
			return new BigInteger(next());
		} nextBigInteger {
			return new BigInteger(next());
		} return new BigInteger(next()); new BigInteger(next()) BigDecimal nextBigDecimal() {
			return new BigDecimal(next());
		} nextBigDecimal {
			return new BigDecimal(next());
		} return new BigDecimal(next()); new BigDecimal(next()) public int[] nextIntArray(final int n) {
			final int[] res = new int [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextInt();
			}
			return res;
		} nextIntArray {
			final int[] res = new int [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextInt();
			}
			return res;
		} final int[] res = new int [n]; res new int [n] n for(int i = 0 ; i < n ;i++) {
				res[i] = nextInt();
			} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
				res[i] = nextInt();
			} {
				res[i] = nextInt();
			} res[i] = nextInt() res[i] res i nextInt() nextInt return res; res final int n n public long[] nextLongArray(final int n) {
			final long[] res= new long [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextLong();
			}
			return res;
		} nextLongArray {
			final long[] res= new long [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextLong();
			}
			return res;
		} final long[] res= new long [n]; res new long [n] n for(int i = 0 ; i < n ;i++) {
				res[i] = nextLong();
			} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
				res[i] = nextLong();
			} {
				res[i] = nextLong();
			} res[i] = nextLong() res[i] res i nextLong() nextLong return res; res final int n n public double[] nextDoubleArray(final int n ) {
			final double[] res = new double [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextDouble();
			}
			return res;
		} nextDoubleArray {
			final double[] res = new double [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextDouble();
			}
			return res;
		} final double[] res = new double [n]; res new double [n] n for(int i = 0 ; i < n ;i++) {
				res[i] = nextDouble();
			} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
				res[i] = nextDouble();
			} {
				res[i] = nextDouble();
			} res[i] = nextDouble() res[i] res i nextDouble() nextDouble return res; res final int n n public int[][] nextInt2DArray(final int n , final int m){
			int [][]res = new int [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				}
			}
			return res;
		} nextInt2DArray {
			int [][]res = new int [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				}
			}
			return res;
		} int [][]res = new int [n][m]; res new int [n][m] n m for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				}
			} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				}
			} {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				}
			} for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				} int j = 0 ; int j = 0 ; j 0 j < m j m j++ j++ j {
					res[i][j] = nextInt();
				} {
					res[i][j] = nextInt();
				} res[i][j] = nextInt() res[i][j] res[i] res i j nextInt() nextInt return res; res final int n n final int m m public long[][] nextLong2DArray(final int n , final int m){
			long [][]res = new long [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				}
			}
			return res;
		} nextLong2DArray {
			long [][]res = new long [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				}
			}
			return res;
		} long [][]res = new long [n][m]; res new long [n][m] n m for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				}
			} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				}
			} {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				}
			} for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				} int j = 0 ; int j = 0 ; j 0 j < m j m j++ j++ j {
					res[i][j] = nextLong();
				} {
					res[i][j] = nextLong();
				} res[i][j] = nextLong() res[i][j] res[i] res i j nextLong() nextLong return res; res final int n n final int m m public char[][] nextChar2DArray(final int n){
			char [][]res = new char [n][];
			
			for(int i = 0 ; i < n ;i++) {
				String s = next();
				res[i] = s.toCharArray();
			}
			
			return res;
		} nextChar2DArray {
			char [][]res = new char [n][];
			
			for(int i = 0 ; i < n ;i++) {
				String s = next();
				res[i] = s.toCharArray();
			}
			
			return res;
		} char [][]res = new char [n][]; res new char [n][] n for(int i = 0 ; i < n ;i++) {
				String s = next();
				res[i] = s.toCharArray();
			} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
				String s = next();
				res[i] = s.toCharArray();
			} {
				String s = next();
				res[i] = s.toCharArray();
			} String s = next(); s next() next res[i] = s.toCharArray() res[i] res i s.toCharArray() s.toCharArray s return res; res final int n n public class Main {
  
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastInput in = new FastInput(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Sample solver = new Sample();
		solver.solve(1, in, out);
		out.close();
	}
	
	static class Sample {
	
		public void solve(int testNum, FastInput in, PrintWriter out) {
			
			String s = in.next();
			String t = in.next();
			
			int n = s.length();
			int m = t.length();
			
			int min = m;
			for(int i = 0 ; i < n - m + 1  ;i++) {
				int tmp = 0;
				for(int j = 0 ; j < m ; j++) {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				}
				min = Math.min(tmp,min);
			}
			
			out.println(min);
			
	
		}
	
	}
	static class FastInput{
		private final BufferedReader in;
		private String[] buff;
		private int index = 0;
		
		public FastInput(InputStream is) {
			in = new BufferedReader(new InputStreamReader(is));
		}
		String nextLine() {
			try {
				return in.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		}
		String next() {
			while (buff == null || index >= buff.length) {
				buff = nextLine().split(" ");
				index = 0;
			}
			return buff[index++];
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		Double nextDouble() {
			return Double.parseDouble(next());
		}
		
		BigInteger nextBigInteger() {
			return new BigInteger(next());
		}
		
		BigDecimal nextBigDecimal() {
			return new BigDecimal(next());
		}
		
		public int[] nextIntArray(final int n) {
			final int[] res = new int [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextInt();
			}
			return res;
		}
		
		public long[] nextLongArray(final int n) {
			final long[] res= new long [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextLong();
			}
			return res;
		}
		
		public double[] nextDoubleArray(final int n ) {
			final double[] res = new double [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextDouble();
			}
			return res;
		}
		
		
		public int[][] nextInt2DArray(final int n , final int m){
			int [][]res = new int [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				}
			}
			return res;
		}
		public long[][] nextLong2DArray(final int n , final int m){
			long [][]res = new long [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				}
			}
			return res;
		}
		
		public char[][] nextChar2DArray(final int n){
			char [][]res = new char [n][];
			
			for(int i = 0 ; i < n ;i++) {
				String s = next();
				res[i] = s.toCharArray();
			}
			
			return res;
		}
	}

} public class Main {
  
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastInput in = new FastInput(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Sample solver = new Sample();
		solver.solve(1, in, out);
		out.close();
	}
	
	static class Sample {
	
		public void solve(int testNum, FastInput in, PrintWriter out) {
			
			String s = in.next();
			String t = in.next();
			
			int n = s.length();
			int m = t.length();
			
			int min = m;
			for(int i = 0 ; i < n - m + 1  ;i++) {
				int tmp = 0;
				for(int j = 0 ; j < m ; j++) {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				}
				min = Math.min(tmp,min);
			}
			
			out.println(min);
			
	
		}
	
	}
	static class FastInput{
		private final BufferedReader in;
		private String[] buff;
		private int index = 0;
		
		public FastInput(InputStream is) {
			in = new BufferedReader(new InputStreamReader(is));
		}
		String nextLine() {
			try {
				return in.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		}
		String next() {
			while (buff == null || index >= buff.length) {
				buff = nextLine().split(" ");
				index = 0;
			}
			return buff[index++];
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		Double nextDouble() {
			return Double.parseDouble(next());
		}
		
		BigInteger nextBigInteger() {
			return new BigInteger(next());
		}
		
		BigDecimal nextBigDecimal() {
			return new BigDecimal(next());
		}
		
		public int[] nextIntArray(final int n) {
			final int[] res = new int [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextInt();
			}
			return res;
		}
		
		public long[] nextLongArray(final int n) {
			final long[] res= new long [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextLong();
			}
			return res;
		}
		
		public double[] nextDoubleArray(final int n ) {
			final double[] res = new double [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextDouble();
			}
			return res;
		}
		
		
		public int[][] nextInt2DArray(final int n , final int m){
			int [][]res = new int [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				}
			}
			return res;
		}
		public long[][] nextLong2DArray(final int n , final int m){
			long [][]res = new long [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				}
			}
			return res;
		}
		
		public char[][] nextChar2DArray(final int n){
			char [][]res = new char [n][];
			
			for(int i = 0 ; i < n ;i++) {
				String s = next();
				res[i] = s.toCharArray();
			}
			
			return res;
		}
	}

} Main

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {
  
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastInput in = new FastInput(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Sample solver = new Sample();
		solver.solve(1, in, out);
		out.close();
	}
	
	static class Sample {
	
		public void solve(int testNum, FastInput in, PrintWriter out) {
			
			String s = in.next();
			String t = in.next();
			
			int n = s.length();
			int m = t.length();
			
			int min = m;
			for(int i = 0 ; i < n - m + 1  ;i++) {
				int tmp = 0;
				for(int j = 0 ; j < m ; j++) {
					if(s.charAt(i+j) != t.charAt(j)) {
						tmp++;
					}
				}
				min = Math.min(tmp,min);
			}
			
			out.println(min);
			
	
		}
	
	}
	static class FastInput{
		private final BufferedReader in;
		private String[] buff;
		private int index = 0;
		
		public FastInput(InputStream is) {
			in = new BufferedReader(new InputStreamReader(is));
		}
		String nextLine() {
			try {
				return in.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		}
		String next() {
			while (buff == null || index >= buff.length) {
				buff = nextLine().split(" ");
				index = 0;
			}
			return buff[index++];
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		Double nextDouble() {
			return Double.parseDouble(next());
		}
		
		BigInteger nextBigInteger() {
			return new BigInteger(next());
		}
		
		BigDecimal nextBigDecimal() {
			return new BigDecimal(next());
		}
		
		public int[] nextIntArray(final int n) {
			final int[] res = new int [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextInt();
			}
			return res;
		}
		
		public long[] nextLongArray(final int n) {
			final long[] res= new long [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextLong();
			}
			return res;
		}
		
		public double[] nextDoubleArray(final int n ) {
			final double[] res = new double [n];
			
			for(int i = 0 ; i < n ;i++) {
				res[i] = nextDouble();
			}
			return res;
		}
		
		
		public int[][] nextInt2DArray(final int n , final int m){
			int [][]res = new int [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextInt();
				}
			}
			return res;
		}
		public long[][] nextLong2DArray(final int n , final int m){
			long [][]res = new long [n][m];
			
			for(int i = 0 ; i < n ;i++) {
				for(int j = 0 ; j < m ;j++) {
					res[i][j] = nextLong();
				}
			}
			return res;
		}
		
		public char[][] nextChar2DArray(final int n){
			char [][]res = new char [n][];
			
			for(int i = 0 ; i < n ;i++) {
				String s = next();
				res[i] = s.toCharArray();
			}
			
			return res;
		}
	}

}
