import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		String s = n();
		String t = n();
		int l = t.length();
		//		int max = 0;
		//		for (int i = 1; i < l; i++) {
		//			String n = t.substring(0, i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		for (int i = l; i >= 0; i--) {
		//			String n = t.substring(l - i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		out(l - max);

		int max = 0;

		for (int i = 0; i <= s.length() - l; i++) {
			String ss = s.substring(i, i + l);
			//debug(ss);
			int count = 0;
			for (int j = 0; j < l; j++) {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			}
			if (max < count) {
				max = count;
			}
		}

		out(l - max);

	}

	/*
	 * 以下メソッド集
	 */

	public static void permutation(String q, String ans) {
		// Base Case
		if (q.length() <= 1) {
			System.out.println(ans + q);
		}
		// General Case
		else {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			}
		}
	}

	static char[][] same(char[][] c, int h, int w) {

		char[][] a = new char[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			}
		}
		return a;

	}

	static int countkuro(char[][] c) {

		int count = 0;
		for (char[] cc : c) {
			for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			}
		}
		return count;
	}

	static void debug() {

		out("---");
	}

	static void debug(Object a) {

		out("-------");
		out(a);
		out("-------");
	}

	static int ketasuu(int n) {

		String str = "" + n;
		return str.length();
	}

	static int account(String str) {

		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {

		return sc.nextInt();
	}

	static long nl() {

		return sc.nextLong();
	}

	static double nd() {

		return sc.nextDouble();
	}

	static String n() {

		return sc.next();
	}

	static char[] nc() {

		return sc.next().toCharArray();
	}

	static int kaijo(int n) {

		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {

		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(Object obj) {
		System.out.println(obj);
	}

	static void outn(Object obj) {
		System.out.print(obj);
	}

	static double max(double d, double e) {

		return Math.max(d, e);
	}

	static long max(long a, long b) {

		return Math.max(a, b);
	}

	static long min(long d, long e) {

		return Math.min(d, e);
	}

	static int min(int a, int b) {

		return Math.min(a, b);
	}
}

class XY {

	int h;
	int w;
	int d;

	XY(int h, int w, int d) {
		this.h = h;
		this.w = w;
		this.d = d;
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		String s = n();
		String t = n();
		int l = t.length();
		//		int max = 0;
		//		for (int i = 1; i < l; i++) {
		//			String n = t.substring(0, i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		for (int i = l; i >= 0; i--) {
		//			String n = t.substring(l - i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		out(l - max);

		int max = 0;

		for (int i = 0; i <= s.length() - l; i++) {
			String ss = s.substring(i, i + l);
			//debug(ss);
			int count = 0;
			for (int j = 0; j < l; j++) {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			}
			if (max < count) {
				max = count;
			}
		}

		out(l - max);

	}

	/*
	 * 以下メソッド集
	 */

	public static void permutation(String q, String ans) {
		// Base Case
		if (q.length() <= 1) {
			System.out.println(ans + q);
		}
		// General Case
		else {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			}
		}
	}

	static char[][] same(char[][] c, int h, int w) {

		char[][] a = new char[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			}
		}
		return a;

	}

	static int countkuro(char[][] c) {

		int count = 0;
		for (char[] cc : c) {
			for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			}
		}
		return count;
	}

	static void debug() {

		out("---");
	}

	static void debug(Object a) {

		out("-------");
		out(a);
		out("-------");
	}

	static int ketasuu(int n) {

		String str = "" + n;
		return str.length();
	}

	static int account(String str) {

		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {

		return sc.nextInt();
	}

	static long nl() {

		return sc.nextLong();
	}

	static double nd() {

		return sc.nextDouble();
	}

	static String n() {

		return sc.next();
	}

	static char[] nc() {

		return sc.next().toCharArray();
	}

	static int kaijo(int n) {

		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {

		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(Object obj) {
		System.out.println(obj);
	}

	static void outn(Object obj) {
		System.out.print(obj);
	}

	static double max(double d, double e) {

		return Math.max(d, e);
	}

	static long max(long a, long b) {

		return Math.max(a, b);
	}

	static long min(long d, long e) {

		return Math.min(d, e);
	}

	static int min(int a, int b) {

		return Math.min(a, b);
	}
} Main public static String Y = "Yes"; Y "Yes" public static String N = "No"; N "No" public static long MOD = (long) (Math.pow(10, 9) + 7); MOD (long) (Math.pow(10, 9) + 7) Math.pow(10, 9) Math.pow Math 10 9 7 public static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {

		String s = n();
		String t = n();
		int l = t.length();
		//		int max = 0;
		//		for (int i = 1; i < l; i++) {
		//			String n = t.substring(0, i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		for (int i = l; i >= 0; i--) {
		//			String n = t.substring(l - i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		out(l - max);

		int max = 0;

		for (int i = 0; i <= s.length() - l; i++) {
			String ss = s.substring(i, i + l);
			//debug(ss);
			int count = 0;
			for (int j = 0; j < l; j++) {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			}
			if (max < count) {
				max = count;
			}
		}

		out(l - max);

	} main {

		String s = n();
		String t = n();
		int l = t.length();
		//		int max = 0;
		//		for (int i = 1; i < l; i++) {
		//			String n = t.substring(0, i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		for (int i = l; i >= 0; i--) {
		//			String n = t.substring(l - i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		out(l - max);

		int max = 0;

		for (int i = 0; i <= s.length() - l; i++) {
			String ss = s.substring(i, i + l);
			//debug(ss);
			int count = 0;
			for (int j = 0; j < l; j++) {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			}
			if (max < count) {
				max = count;
			}
		}

		out(l - max);

	} String s = n(); s n() n String t = n(); t n() n int l = t.length(); l t.length() t.length t int max = 0; max 0 for (int i = 0; i <= s.length() - l; i++) {
			String ss = s.substring(i, i + l);
			//debug(ss);
			int count = 0;
			for (int j = 0; j < l; j++) {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			}
			if (max < count) {
				max = count;
			}
		} int i = 0; int i = 0; i 0 i <= s.length() - l i s.length() - l s.length() s.length s l i++ i++ i {
			String ss = s.substring(i, i + l);
			//debug(ss);
			int count = 0;
			for (int j = 0; j < l; j++) {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			}
			if (max < count) {
				max = count;
			}
		} {
			String ss = s.substring(i, i + l);
			//debug(ss);
			int count = 0;
			for (int j = 0; j < l; j++) {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			}
			if (max < count) {
				max = count;
			}
		} String ss = s.substring(i, i + l); ss s.substring(i, i + l) s.substring s i i + l i l int count = 0; count 0 for (int j = 0; j < l; j++) {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			} int j = 0; int j = 0; j 0 j < l j l j++ j++ j {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			} {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			} if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				} ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1)) ss.substring(j, j + 1).contentEquals ss.substring(j, j + 1) ss.substring ss j j + 1 j 1 t.substring(j, j + 1) t.substring t j j + 1 j 1 {
					count++;
				} count++ count if (max < count) {
				max = count;
			} max < count max count {
				max = count;
			} max = count max count out(l - max) out l - max l max String[] args args public static void permutation(String q, String ans) {
		// Base Case
		if (q.length() <= 1) {
			System.out.println(ans + q);
		}
		// General Case
		else {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			}
		}
	} permutation {
		// Base Case
		if (q.length() <= 1) {
			System.out.println(ans + q);
		}
		// General Case
		else {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			}
		}
	} if (q.length() <= 1) {
			System.out.println(ans + q);
		}
		// General Case
		else {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			}
		} q.length() <= 1 q.length() q.length q 1 {
			System.out.println(ans + q);
		} System.out.println(ans + q) System.out.println System.out System System.out ans + q ans q {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			}
		} for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			} int i = 0; int i = 0; i 0 i < q.length() i q.length() q.length q i++ i++ i {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			} {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			} permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i)) permutation q.substring(0, i) + q.substring(i + 1) q.substring(0, i) q.substring q 0 i q.substring(i + 1) q.substring q i + 1 i 1 ans + q.charAt(i) ans q.charAt(i) q.charAt q i String q q String ans ans static char[][] same(char[][] c, int h, int w) {

		char[][] a = new char[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			}
		}
		return a;

	} same {

		char[][] a = new char[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			}
		}
		return a;

	} char[][] a = new char[h][w]; a new char[h][w] h w for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			}
		} int i = 0; int i = 0; i 0 i < h i h i++ i++ i {
			for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			}
		} {
			for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			}
		} for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			} int j = 0; int j = 0; j 0 j < w j w j++ j++ j {
				a[i][j] = c[i][j];
			} {
				a[i][j] = c[i][j];
			} a[i][j] = c[i][j] a[i][j] a[i] a i j c[i][j] c[i] c i j return a; a char[][] c c int h h int w w static int countkuro(char[][] c) {

		int count = 0;
		for (char[] cc : c) {
			for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			}
		}
		return count;
	} countkuro {

		int count = 0;
		for (char[] cc : c) {
			for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			}
		}
		return count;
	} int count = 0; count 0 for (char[] cc : c) {
			for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			}
		} char[] cc c {
			for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			}
		} {
			for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			}
		} for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			} char ccc cc {
				if ('#' == ccc) {
					count++;
				}
			} {
				if ('#' == ccc) {
					count++;
				}
			} if ('#' == ccc) {
					count++;
				} '#' == ccc '#' ccc {
					count++;
				} count++ count return count; count char[][] c c static void debug() {

		out("---");
	} debug {

		out("---");
	} out("---") out "---" static void debug(Object a) {

		out("-------");
		out(a);
		out("-------");
	} debug {

		out("-------");
		out(a);
		out("-------");
	} out("-------") out "-------" out(a) out a out("-------") out "-------" Object a a static int ketasuu(int n) {

		String str = "" + n;
		return str.length();
	} ketasuu {

		String str = "" + n;
		return str.length();
	} String str = "" + n; str "" + n "" n return str.length(); str.length() str.length str int n n static int account(String str) {

		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	} account {

		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	} String target = "AC"; target "AC" int count = 0; count 0 int len = str.length(); len str.length() str.length str for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		} int i = 0; int i = 0; i 0 i < len - 1 i len - 1 len 1 i++ i++ i {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		} {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		} if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			} target.equals(str.substring(i, i + target.length())) target.equals target str.substring(i, i + target.length()) str.substring str i i + target.length() i target.length() target.length target {
				count++;
			} count++ count return count; count String str str static int ni() {

		return sc.nextInt();
	} ni {

		return sc.nextInt();
	} return sc.nextInt(); sc.nextInt() sc.nextInt sc static long nl() {

		return sc.nextLong();
	} nl {

		return sc.nextLong();
	} return sc.nextLong(); sc.nextLong() sc.nextLong sc static double nd() {

		return sc.nextDouble();
	} nd {

		return sc.nextDouble();
	} return sc.nextDouble(); sc.nextDouble() sc.nextDouble sc static String n() {

		return sc.next();
	} n {

		return sc.next();
	} return sc.next(); sc.next() sc.next sc static char[] nc() {

		return sc.next().toCharArray();
	} nc {

		return sc.next().toCharArray();
	} return sc.next().toCharArray(); sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc static int kaijo(int n) {

		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	} kaijo {

		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	} if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		} n == 0 || n == 1 n == 0 n 0 n == 1 n 1 {
			return 1;
		} return 1; 1 {
			return n * kaijo(n - 1);
		} return n * kaijo(n - 1); n * kaijo(n - 1) n kaijo(n - 1) kaijo n - 1 n 1 int n n static int fib(int n) {

		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	} fib {

		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	} return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1); (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1) (n == 1 || n == 0) n == 1 n 1 n == 0 n 0 n fib(n - 2) + fib(n - 1) fib(n - 2) fib n - 2 n 2 fib(n - 1) fib n - 1 n 1 int n n static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	} lcm {

		return m * n / gcd(m, n);
	} return m * n / gcd(m, n); m * n / gcd(m, n) m * n m n gcd(m, n) gcd m n long m m long n n static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	} lcm {

		return m * n / gcd(m, n);
	} return m * n / gcd(m, n); m * n / gcd(m, n) m * n m n gcd(m, n) gcd m n int m m int n n static long gcd(long a, long b) {

		return (b == 0) ? a : gcd(b, a % b);
	} gcd {

		return (b == 0) ? a : gcd(b, a % b);
	} return (b == 0) ? a : gcd(b, a % b); (b == 0) ? a : gcd(b, a % b) (b == 0) b 0 a gcd(b, a % b) gcd b a % b a b long a a long b b static int gcd(int a, int b) {

		return (b == 0) ? a : gcd(b, a % b);
	} gcd {

		return (b == 0) ? a : gcd(b, a % b);
	} return (b == 0) ? a : gcd(b, a % b); (b == 0) ? a : gcd(b, a % b) (b == 0) b 0 a gcd(b, a % b) gcd b a % b a b int a a int b b static void out(Object obj) {
		System.out.println(obj);
	} out {
		System.out.println(obj);
	} System.out.println(obj) System.out.println System.out System System.out obj Object obj obj static void outn(Object obj) {
		System.out.print(obj);
	} outn {
		System.out.print(obj);
	} System.out.print(obj) System.out.print System.out System System.out obj Object obj obj static double max(double d, double e) {

		return Math.max(d, e);
	} max {

		return Math.max(d, e);
	} return Math.max(d, e); Math.max(d, e) Math.max Math d e double d d double e e static long max(long a, long b) {

		return Math.max(a, b);
	} max {

		return Math.max(a, b);
	} return Math.max(a, b); Math.max(a, b) Math.max Math a b long a a long b b static long min(long d, long e) {

		return Math.min(d, e);
	} min {

		return Math.min(d, e);
	} return Math.min(d, e); Math.min(d, e) Math.min Math d e long d d long e e static int min(int a, int b) {

		return Math.min(a, b);
	} min {

		return Math.min(a, b);
	} return Math.min(a, b); Math.min(a, b) Math.min Math a b int a a int b b class XY {

	int h;
	int w;
	int d;

	XY(int h, int w, int d) {
		this.h = h;
		this.w = w;
		this.d = d;
	}
} XY int h; h int w; w int d; d XY(int h, int w, int d) {
		this.h = h;
		this.w = w;
		this.d = d;
	} XY {
		this.h = h;
		this.w = w;
		this.d = d;
	} this.h = h this.h this this.h h this.w = w this.w this this.w w this.d = d this.d this this.d d int h h int w w int d d public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		String s = n();
		String t = n();
		int l = t.length();
		//		int max = 0;
		//		for (int i = 1; i < l; i++) {
		//			String n = t.substring(0, i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		for (int i = l; i >= 0; i--) {
		//			String n = t.substring(l - i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		out(l - max);

		int max = 0;

		for (int i = 0; i <= s.length() - l; i++) {
			String ss = s.substring(i, i + l);
			//debug(ss);
			int count = 0;
			for (int j = 0; j < l; j++) {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			}
			if (max < count) {
				max = count;
			}
		}

		out(l - max);

	}

	/*
	 * 以下メソッド集
	 */

	public static void permutation(String q, String ans) {
		// Base Case
		if (q.length() <= 1) {
			System.out.println(ans + q);
		}
		// General Case
		else {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			}
		}
	}

	static char[][] same(char[][] c, int h, int w) {

		char[][] a = new char[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			}
		}
		return a;

	}

	static int countkuro(char[][] c) {

		int count = 0;
		for (char[] cc : c) {
			for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			}
		}
		return count;
	}

	static void debug() {

		out("---");
	}

	static void debug(Object a) {

		out("-------");
		out(a);
		out("-------");
	}

	static int ketasuu(int n) {

		String str = "" + n;
		return str.length();
	}

	static int account(String str) {

		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {

		return sc.nextInt();
	}

	static long nl() {

		return sc.nextLong();
	}

	static double nd() {

		return sc.nextDouble();
	}

	static String n() {

		return sc.next();
	}

	static char[] nc() {

		return sc.next().toCharArray();
	}

	static int kaijo(int n) {

		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {

		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(Object obj) {
		System.out.println(obj);
	}

	static void outn(Object obj) {
		System.out.print(obj);
	}

	static double max(double d, double e) {

		return Math.max(d, e);
	}

	static long max(long a, long b) {

		return Math.max(a, b);
	}

	static long min(long d, long e) {

		return Math.min(d, e);
	}

	static int min(int a, int b) {

		return Math.min(a, b);
	}
} public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		String s = n();
		String t = n();
		int l = t.length();
		//		int max = 0;
		//		for (int i = 1; i < l; i++) {
		//			String n = t.substring(0, i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		for (int i = l; i >= 0; i--) {
		//			String n = t.substring(l - i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		out(l - max);

		int max = 0;

		for (int i = 0; i <= s.length() - l; i++) {
			String ss = s.substring(i, i + l);
			//debug(ss);
			int count = 0;
			for (int j = 0; j < l; j++) {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			}
			if (max < count) {
				max = count;
			}
		}

		out(l - max);

	}

	/*
	 * 以下メソッド集
	 */

	public static void permutation(String q, String ans) {
		// Base Case
		if (q.length() <= 1) {
			System.out.println(ans + q);
		}
		// General Case
		else {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			}
		}
	}

	static char[][] same(char[][] c, int h, int w) {

		char[][] a = new char[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			}
		}
		return a;

	}

	static int countkuro(char[][] c) {

		int count = 0;
		for (char[] cc : c) {
			for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			}
		}
		return count;
	}

	static void debug() {

		out("---");
	}

	static void debug(Object a) {

		out("-------");
		out(a);
		out("-------");
	}

	static int ketasuu(int n) {

		String str = "" + n;
		return str.length();
	}

	static int account(String str) {

		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {

		return sc.nextInt();
	}

	static long nl() {

		return sc.nextLong();
	}

	static double nd() {

		return sc.nextDouble();
	}

	static String n() {

		return sc.next();
	}

	static char[] nc() {

		return sc.next().toCharArray();
	}

	static int kaijo(int n) {

		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {

		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(Object obj) {
		System.out.println(obj);
	}

	static void outn(Object obj) {
		System.out.print(obj);
	}

	static double max(double d, double e) {

		return Math.max(d, e);
	}

	static long max(long a, long b) {

		return Math.max(a, b);
	}

	static long min(long d, long e) {

		return Math.min(d, e);
	}

	static int min(int a, int b) {

		return Math.min(a, b);
	}
} Main
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		String s = n();
		String t = n();
		int l = t.length();
		//		int max = 0;
		//		for (int i = 1; i < l; i++) {
		//			String n = t.substring(0, i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		for (int i = l; i >= 0; i--) {
		//			String n = t.substring(l - i);
		//			if (s.contains(n)) {
		//				if (max < i) {
		//					max = i;
		//				}
		//			}
		//		}
		//
		//		out(l - max);

		int max = 0;

		for (int i = 0; i <= s.length() - l; i++) {
			String ss = s.substring(i, i + l);
			//debug(ss);
			int count = 0;
			for (int j = 0; j < l; j++) {
				//debug(ss);
				if (ss.substring(j, j + 1).contentEquals(t.substring(j, j + 1))) {
					count++;
				}
			}
			if (max < count) {
				max = count;
			}
		}

		out(l - max);

	}

	/*
	 * 以下メソッド集
	 */

	public static void permutation(String q, String ans) {
		// Base Case
		if (q.length() <= 1) {
			System.out.println(ans + q);
		}
		// General Case
		else {
			for (int i = 0; i < q.length(); i++) {
				permutation(q.substring(0, i) + q.substring(i + 1),
						ans + q.charAt(i));
			}
		}
	}

	static char[][] same(char[][] c, int h, int w) {

		char[][] a = new char[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = c[i][j];
			}
		}
		return a;

	}

	static int countkuro(char[][] c) {

		int count = 0;
		for (char[] cc : c) {
			for (char ccc : cc) {
				if ('#' == ccc) {
					count++;
				}
			}
		}
		return count;
	}

	static void debug() {

		out("---");
	}

	static void debug(Object a) {

		out("-------");
		out(a);
		out("-------");
	}

	static int ketasuu(int n) {

		String str = "" + n;
		return str.length();
	}

	static int account(String str) {

		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {

		return sc.nextInt();
	}

	static long nl() {

		return sc.nextLong();
	}

	static double nd() {

		return sc.nextDouble();
	}

	static String n() {

		return sc.next();
	}

	static char[] nc() {

		return sc.next().toCharArray();
	}

	static int kaijo(int n) {

		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {

		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {

		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(Object obj) {
		System.out.println(obj);
	}

	static void outn(Object obj) {
		System.out.print(obj);
	}

	static double max(double d, double e) {

		return Math.max(d, e);
	}

	static long max(long a, long b) {

		return Math.max(a, b);
	}

	static long min(long d, long e) {

		return Math.min(d, e);
	}

	static int min(int a, int b) {

		return Math.min(a, b);
	}
}

class XY {

	int h;
	int w;
	int d;

	XY(int h, int w, int d) {
		this.h = h;
		this.w = w;
		this.d = d;
	}
}
