import java.util.*;
import java.awt.Frame;
import java.io.*;

public class Main {
	// static ArrayList<Integer>[] g;

	static pair[] a;
	static int[][] memo;

	static int dp(int l, int r) {
		if (l > r)
			return 0;
		if (memo[l][r] != -1)
			return memo[l][r];
		int ans = dp(l + 1, r);
		ans = Math.max(ans, dp(l, r - 1));
		for (int idx : startAt[l]) {
			if (a[idx].y >= r)
				continue;
			int inc = exist[a[idx].y + 1][r] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}
		for (int idx : endAt[r]) {
			if (a[idx].x <= l)
				continue;
			int inc = exist[l][a[idx].x - 1] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}

		return memo[l][r] = ans;
	}

	public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);

		char[] s=br.readLine().toCharArray();
		char[] t=br.readLine().toCharArray();
		int min=Integer.MAX_VALUE;
		for (int i = 0; i+t.length <= s.length; i++) {
			int c=0;
			for (int j = 0; j <t.length ; j++) {
				if(t[j]!=s[i+j])
					c++;
			}
			min=Math.min(min, c);
		}
		pw.println(min);
		pw.flush();
		pw.close();

	}

	static ArrayList<Integer> primes;
	static int[] isComposite;

	static void sieve(int N) // O(N log log N)
	{
		isComposite = new int[N + 1];
		isComposite[0] = isComposite[1] = 1; // 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			}
	}

	static long pow(long a, long e, int mod) // O(log e)
	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1) {
				res *= a;
				res %= mod;
			}
			a *= a;
			a %= mod;
			e >>= 1;
		}
		return res;
	}

	static int maxSize;
	static boolean[][] exist;
	static ArrayList<Integer>[] startAt, endAt;

	static void compress(pair[] arr) {
		TreeSet<Integer> tr = new TreeSet<>();
		for (int i = 0; i < arr.length; i++) {
			tr.add(arr[i].x);
			tr.add(arr[i].y);
		}
		tr.add(0);
		tr.add((int) 1e9);
		HashMap<Integer, Integer> hm = new HashMap<>();
		for (int x : tr)
			hm.put(x, hm.size());
		for (int i = 0; i < arr.length; i++) {
			arr[i].x = hm.get(arr[i].x);
			arr[i].y = hm.get(arr[i].y);
		}
		maxSize = hm.size();
	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int u) {
			x = d;
			y = u;
		}

		@Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
			int x1 = y - x;
			int x2 = o.y - o.x;
			return x1 - x2;
		}

	}

} import java.util.*; util.* java import java.awt.Frame; Frame java.awt import java.io.*; io.* java public class Main {
	// static ArrayList<Integer>[] g;

	static pair[] a;
	static int[][] memo;

	static int dp(int l, int r) {
		if (l > r)
			return 0;
		if (memo[l][r] != -1)
			return memo[l][r];
		int ans = dp(l + 1, r);
		ans = Math.max(ans, dp(l, r - 1));
		for (int idx : startAt[l]) {
			if (a[idx].y >= r)
				continue;
			int inc = exist[a[idx].y + 1][r] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}
		for (int idx : endAt[r]) {
			if (a[idx].x <= l)
				continue;
			int inc = exist[l][a[idx].x - 1] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}

		return memo[l][r] = ans;
	}

	public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);

		char[] s=br.readLine().toCharArray();
		char[] t=br.readLine().toCharArray();
		int min=Integer.MAX_VALUE;
		for (int i = 0; i+t.length <= s.length; i++) {
			int c=0;
			for (int j = 0; j <t.length ; j++) {
				if(t[j]!=s[i+j])
					c++;
			}
			min=Math.min(min, c);
		}
		pw.println(min);
		pw.flush();
		pw.close();

	}

	static ArrayList<Integer> primes;
	static int[] isComposite;

	static void sieve(int N) // O(N log log N)
	{
		isComposite = new int[N + 1];
		isComposite[0] = isComposite[1] = 1; // 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			}
	}

	static long pow(long a, long e, int mod) // O(log e)
	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1) {
				res *= a;
				res %= mod;
			}
			a *= a;
			a %= mod;
			e >>= 1;
		}
		return res;
	}

	static int maxSize;
	static boolean[][] exist;
	static ArrayList<Integer>[] startAt, endAt;

	static void compress(pair[] arr) {
		TreeSet<Integer> tr = new TreeSet<>();
		for (int i = 0; i < arr.length; i++) {
			tr.add(arr[i].x);
			tr.add(arr[i].y);
		}
		tr.add(0);
		tr.add((int) 1e9);
		HashMap<Integer, Integer> hm = new HashMap<>();
		for (int x : tr)
			hm.put(x, hm.size());
		for (int i = 0; i < arr.length; i++) {
			arr[i].x = hm.get(arr[i].x);
			arr[i].y = hm.get(arr[i].y);
		}
		maxSize = hm.size();
	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int u) {
			x = d;
			y = u;
		}

		@Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
			int x1 = y - x;
			int x2 = o.y - o.x;
			return x1 - x2;
		}

	}

} Main static pair[] a; a static int[][] memo; memo static ArrayList<Integer> primes; primes static int[] isComposite; isComposite static int maxSize; maxSize static boolean[][] exist; exist static ArrayList<Integer>[] startAt startAt endAt; endAt static int dp(int l, int r) {
		if (l > r)
			return 0;
		if (memo[l][r] != -1)
			return memo[l][r];
		int ans = dp(l + 1, r);
		ans = Math.max(ans, dp(l, r - 1));
		for (int idx : startAt[l]) {
			if (a[idx].y >= r)
				continue;
			int inc = exist[a[idx].y + 1][r] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}
		for (int idx : endAt[r]) {
			if (a[idx].x <= l)
				continue;
			int inc = exist[l][a[idx].x - 1] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}

		return memo[l][r] = ans;
	} dp {
		if (l > r)
			return 0;
		if (memo[l][r] != -1)
			return memo[l][r];
		int ans = dp(l + 1, r);
		ans = Math.max(ans, dp(l, r - 1));
		for (int idx : startAt[l]) {
			if (a[idx].y >= r)
				continue;
			int inc = exist[a[idx].y + 1][r] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}
		for (int idx : endAt[r]) {
			if (a[idx].x <= l)
				continue;
			int inc = exist[l][a[idx].x - 1] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}

		return memo[l][r] = ans;
	} if (l > r)
			return 0; l > r l r return 0; 0 if (memo[l][r] != -1)
			return memo[l][r]; memo[l][r] != -1 memo[l][r] memo[l] memo l r -1 1 return memo[l][r]; memo[l][r] memo[l] memo l r int ans = dp(l + 1, r); ans dp(l + 1, r) dp l + 1 l 1 r ans = Math.max(ans, dp(l, r - 1)) ans Math.max(ans, dp(l, r - 1)) Math.max Math ans dp(l, r - 1) dp l r - 1 r 1 for (int idx : startAt[l]) {
			if (a[idx].y >= r)
				continue;
			int inc = exist[a[idx].y + 1][r] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		} int idx startAt[l] startAt l {
			if (a[idx].y >= r)
				continue;
			int inc = exist[a[idx].y + 1][r] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		} {
			if (a[idx].y >= r)
				continue;
			int inc = exist[a[idx].y + 1][r] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		} if (a[idx].y >= r)
				continue; a[idx].y >= r a[idx].y a[idx] a idx a[idx].y r continue; int inc = exist[a[idx].y + 1][r] ? 1 : 0; inc exist[a[idx].y + 1][r] ? 1 : 0 exist[a[idx].y + 1][r] exist[a[idx].y + 1] exist a[idx].y + 1 a[idx].y a[idx] a idx a[idx].y 1 r 1 0 ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r)) ans Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r)) Math.max Math ans 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r) inc 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r) 1 dp(a[idx].x, a[idx].y) dp a[idx].x a[idx] a idx a[idx].x a[idx].y a[idx] a idx a[idx].y inc dp(a[idx].y + 1, r) dp a[idx].y + 1 a[idx].y a[idx] a idx a[idx].y 1 r for (int idx : endAt[r]) {
			if (a[idx].x <= l)
				continue;
			int inc = exist[l][a[idx].x - 1] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		} int idx endAt[r] endAt r {
			if (a[idx].x <= l)
				continue;
			int inc = exist[l][a[idx].x - 1] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		} {
			if (a[idx].x <= l)
				continue;
			int inc = exist[l][a[idx].x - 1] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		} if (a[idx].x <= l)
				continue; a[idx].x <= l a[idx].x a[idx] a idx a[idx].x l continue; int inc = exist[l][a[idx].x - 1] ? 1 : 0; inc exist[l][a[idx].x - 1] ? 1 : 0 exist[l][a[idx].x - 1] exist[l] exist l a[idx].x - 1 a[idx].x a[idx] a idx a[idx].x 1 1 0 ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r)) ans Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r)) Math.max Math ans 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r) inc 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r) 1 dp(a[idx].x, a[idx].y) dp a[idx].x a[idx] a idx a[idx].x a[idx].y a[idx] a idx a[idx].y inc dp(a[idx].y + 1, r) dp a[idx].y + 1 a[idx].y a[idx] a idx a[idx].y 1 r return memo[l][r] = ans; memo[l][r] = ans memo[l][r] memo[l] memo l r ans int l l int r r public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);

		char[] s=br.readLine().toCharArray();
		char[] t=br.readLine().toCharArray();
		int min=Integer.MAX_VALUE;
		for (int i = 0; i+t.length <= s.length; i++) {
			int c=0;
			for (int j = 0; j <t.length ; j++) {
				if(t[j]!=s[i+j])
					c++;
			}
			min=Math.min(min, c);
		}
		pw.println(min);
		pw.flush();
		pw.close();

	} main {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);

		char[] s=br.readLine().toCharArray();
		char[] t=br.readLine().toCharArray();
		int min=Integer.MAX_VALUE;
		for (int i = 0; i+t.length <= s.length; i++) {
			int c=0;
			for (int j = 0; j <t.length ; j++) {
				if(t[j]!=s[i+j])
					c++;
			}
			min=Math.min(min, c);
		}
		pw.println(min);
		pw.flush();
		pw.close();

	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) char[] s=br.readLine().toCharArray(); s br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br char[] t=br.readLine().toCharArray(); t br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br int min=Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i+t.length <= s.length; i++) {
			int c=0;
			for (int j = 0; j <t.length ; j++) {
				if(t[j]!=s[i+j])
					c++;
			}
			min=Math.min(min, c);
		} int i = 0; int i = 0; i 0 i+t.length <= s.length i+t.length i t.length t t.length s.length s s.length i++ i++ i {
			int c=0;
			for (int j = 0; j <t.length ; j++) {
				if(t[j]!=s[i+j])
					c++;
			}
			min=Math.min(min, c);
		} {
			int c=0;
			for (int j = 0; j <t.length ; j++) {
				if(t[j]!=s[i+j])
					c++;
			}
			min=Math.min(min, c);
		} int c=0; c 0 for (int j = 0; j <t.length ; j++) {
				if(t[j]!=s[i+j])
					c++;
			} int j = 0; int j = 0; j 0 j <t.length j t.length t t.length j++ j++ j {
				if(t[j]!=s[i+j])
					c++;
			} {
				if(t[j]!=s[i+j])
					c++;
			} if(t[j]!=s[i+j])
					c++; t[j]!=s[i+j] t[j] t j s[i+j] s i+j i j c++ c min=Math.min(min, c) min Math.min(min, c) Math.min Math min c pw.println(min) pw.println pw min pw.flush() pw.flush pw pw.close() pw.close pw String[] args args static void sieve(int N) // O(N log log N)
	{
		isComposite = new int[N + 1];
		isComposite[0] = isComposite[1] = 1; // 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			}
	} sieve {
		isComposite = new int[N + 1];
		isComposite[0] = isComposite[1] = 1; // 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			}
	} isComposite = new int[N + 1] isComposite new int[N + 1] N + 1 N 1 isComposite[0] = isComposite[1] = 1 isComposite[0] isComposite 0 isComposite[1] = 1 isComposite[1] isComposite 1 1 primes = new ArrayList<Integer>() primes new ArrayList<Integer>() for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			} int i = 2; int i = 2; i 2 i <= N i N ++i ++i i if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			} if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			} isComposite[i] == 0 isComposite[i] isComposite i 0 {
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			} primes.add(i) primes.add primes i if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1; 1l * i * i <= N 1l * i * i 1l * i * i 1l i i N for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1; int j = i * i; int j = i * i; j i * i i i j <= N j N j += i j += i j i isComposite[j] = 1; isComposite[j] = 1 isComposite[j] isComposite j 1 int N N static long pow(long a, long e, int mod) // O(log e)
	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1) {
				res *= a;
				res %= mod;
			}
			a *= a;
			a %= mod;
			e >>= 1;
		}
		return res;
	} pow {
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1) {
				res *= a;
				res %= mod;
			}
			a *= a;
			a %= mod;
			e >>= 1;
		}
		return res;
	} long res = 1; res 1 while (e > 0) {
			if ((e & 1) == 1) {
				res *= a;
				res %= mod;
			}
			a *= a;
			a %= mod;
			e >>= 1;
		} e > 0 e 0 {
			if ((e & 1) == 1) {
				res *= a;
				res %= mod;
			}
			a *= a;
			a %= mod;
			e >>= 1;
		} if ((e & 1) == 1) {
				res *= a;
				res %= mod;
			} (e & 1) == 1 (e & 1) e 1 1 {
				res *= a;
				res %= mod;
			} res *= a res a res %= mod res mod a *= a a a a %= mod a mod e >>= 1 e 1 return res; res long a a long e e int mod mod static void compress(pair[] arr) {
		TreeSet<Integer> tr = new TreeSet<>();
		for (int i = 0; i < arr.length; i++) {
			tr.add(arr[i].x);
			tr.add(arr[i].y);
		}
		tr.add(0);
		tr.add((int) 1e9);
		HashMap<Integer, Integer> hm = new HashMap<>();
		for (int x : tr)
			hm.put(x, hm.size());
		for (int i = 0; i < arr.length; i++) {
			arr[i].x = hm.get(arr[i].x);
			arr[i].y = hm.get(arr[i].y);
		}
		maxSize = hm.size();
	} compress {
		TreeSet<Integer> tr = new TreeSet<>();
		for (int i = 0; i < arr.length; i++) {
			tr.add(arr[i].x);
			tr.add(arr[i].y);
		}
		tr.add(0);
		tr.add((int) 1e9);
		HashMap<Integer, Integer> hm = new HashMap<>();
		for (int x : tr)
			hm.put(x, hm.size());
		for (int i = 0; i < arr.length; i++) {
			arr[i].x = hm.get(arr[i].x);
			arr[i].y = hm.get(arr[i].y);
		}
		maxSize = hm.size();
	} TreeSet<Integer> tr = new TreeSet<>(); tr new TreeSet<>() for (int i = 0; i < arr.length; i++) {
			tr.add(arr[i].x);
			tr.add(arr[i].y);
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
			tr.add(arr[i].x);
			tr.add(arr[i].y);
		} {
			tr.add(arr[i].x);
			tr.add(arr[i].y);
		} tr.add(arr[i].x) tr.add tr arr[i].x arr[i] arr i arr[i].x tr.add(arr[i].y) tr.add tr arr[i].y arr[i] arr i arr[i].y tr.add(0) tr.add tr 0 tr.add((int) 1e9) tr.add tr (int) 1e9 HashMap<Integer, Integer> hm = new HashMap<>(); hm new HashMap<>() for (int x : tr)
			hm.put(x, hm.size()); int x tr hm.put(x, hm.size()); hm.put(x, hm.size()) hm.put hm x hm.size() hm.size hm for (int i = 0; i < arr.length; i++) {
			arr[i].x = hm.get(arr[i].x);
			arr[i].y = hm.get(arr[i].y);
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
			arr[i].x = hm.get(arr[i].x);
			arr[i].y = hm.get(arr[i].y);
		} {
			arr[i].x = hm.get(arr[i].x);
			arr[i].y = hm.get(arr[i].y);
		} arr[i].x = hm.get(arr[i].x) arr[i].x arr[i] arr i arr[i].x hm.get(arr[i].x) hm.get hm arr[i].x arr[i] arr i arr[i].x arr[i].y = hm.get(arr[i].y) arr[i].y arr[i] arr i arr[i].y hm.get(arr[i].y) hm.get hm arr[i].y arr[i] arr i arr[i].y maxSize = hm.size() maxSize hm.size() hm.size hm pair[] arr arr static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int u) {
			x = d;
			y = u;
		}

		@Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
			int x1 = y - x;
			int x2 = o.y - o.x;
			return x1 - x2;
		}

	} pair int x; x int y; y public pair(int d, int u) {
			x = d;
			y = u;
		} pair {
			x = d;
			y = u;
		} x = d x d y = u y u int d d int u u @Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
			int x1 = y - x;
			int x2 = o.y - o.x;
			return x1 - x2;
		} compareTo {
			// TODO Auto-generated method stub
			int x1 = y - x;
			int x2 = o.y - o.x;
			return x1 - x2;
		} int x1 = y - x; x1 y - x y x int x2 = o.y - o.x; x2 o.y - o.x o.y o o.y o.x o o.x return x1 - x2; x1 - x2 x1 x2 pair o o Comparable public class Main {
	// static ArrayList<Integer>[] g;

	static pair[] a;
	static int[][] memo;

	static int dp(int l, int r) {
		if (l > r)
			return 0;
		if (memo[l][r] != -1)
			return memo[l][r];
		int ans = dp(l + 1, r);
		ans = Math.max(ans, dp(l, r - 1));
		for (int idx : startAt[l]) {
			if (a[idx].y >= r)
				continue;
			int inc = exist[a[idx].y + 1][r] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}
		for (int idx : endAt[r]) {
			if (a[idx].x <= l)
				continue;
			int inc = exist[l][a[idx].x - 1] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}

		return memo[l][r] = ans;
	}

	public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);

		char[] s=br.readLine().toCharArray();
		char[] t=br.readLine().toCharArray();
		int min=Integer.MAX_VALUE;
		for (int i = 0; i+t.length <= s.length; i++) {
			int c=0;
			for (int j = 0; j <t.length ; j++) {
				if(t[j]!=s[i+j])
					c++;
			}
			min=Math.min(min, c);
		}
		pw.println(min);
		pw.flush();
		pw.close();

	}

	static ArrayList<Integer> primes;
	static int[] isComposite;

	static void sieve(int N) // O(N log log N)
	{
		isComposite = new int[N + 1];
		isComposite[0] = isComposite[1] = 1; // 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			}
	}

	static long pow(long a, long e, int mod) // O(log e)
	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1) {
				res *= a;
				res %= mod;
			}
			a *= a;
			a %= mod;
			e >>= 1;
		}
		return res;
	}

	static int maxSize;
	static boolean[][] exist;
	static ArrayList<Integer>[] startAt, endAt;

	static void compress(pair[] arr) {
		TreeSet<Integer> tr = new TreeSet<>();
		for (int i = 0; i < arr.length; i++) {
			tr.add(arr[i].x);
			tr.add(arr[i].y);
		}
		tr.add(0);
		tr.add((int) 1e9);
		HashMap<Integer, Integer> hm = new HashMap<>();
		for (int x : tr)
			hm.put(x, hm.size());
		for (int i = 0; i < arr.length; i++) {
			arr[i].x = hm.get(arr[i].x);
			arr[i].y = hm.get(arr[i].y);
		}
		maxSize = hm.size();
	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int u) {
			x = d;
			y = u;
		}

		@Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
			int x1 = y - x;
			int x2 = o.y - o.x;
			return x1 - x2;
		}

	}

} public class Main {
	// static ArrayList<Integer>[] g;

	static pair[] a;
	static int[][] memo;

	static int dp(int l, int r) {
		if (l > r)
			return 0;
		if (memo[l][r] != -1)
			return memo[l][r];
		int ans = dp(l + 1, r);
		ans = Math.max(ans, dp(l, r - 1));
		for (int idx : startAt[l]) {
			if (a[idx].y >= r)
				continue;
			int inc = exist[a[idx].y + 1][r] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}
		for (int idx : endAt[r]) {
			if (a[idx].x <= l)
				continue;
			int inc = exist[l][a[idx].x - 1] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}

		return memo[l][r] = ans;
	}

	public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);

		char[] s=br.readLine().toCharArray();
		char[] t=br.readLine().toCharArray();
		int min=Integer.MAX_VALUE;
		for (int i = 0; i+t.length <= s.length; i++) {
			int c=0;
			for (int j = 0; j <t.length ; j++) {
				if(t[j]!=s[i+j])
					c++;
			}
			min=Math.min(min, c);
		}
		pw.println(min);
		pw.flush();
		pw.close();

	}

	static ArrayList<Integer> primes;
	static int[] isComposite;

	static void sieve(int N) // O(N log log N)
	{
		isComposite = new int[N + 1];
		isComposite[0] = isComposite[1] = 1; // 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			}
	}

	static long pow(long a, long e, int mod) // O(log e)
	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1) {
				res *= a;
				res %= mod;
			}
			a *= a;
			a %= mod;
			e >>= 1;
		}
		return res;
	}

	static int maxSize;
	static boolean[][] exist;
	static ArrayList<Integer>[] startAt, endAt;

	static void compress(pair[] arr) {
		TreeSet<Integer> tr = new TreeSet<>();
		for (int i = 0; i < arr.length; i++) {
			tr.add(arr[i].x);
			tr.add(arr[i].y);
		}
		tr.add(0);
		tr.add((int) 1e9);
		HashMap<Integer, Integer> hm = new HashMap<>();
		for (int x : tr)
			hm.put(x, hm.size());
		for (int i = 0; i < arr.length; i++) {
			arr[i].x = hm.get(arr[i].x);
			arr[i].y = hm.get(arr[i].y);
		}
		maxSize = hm.size();
	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int u) {
			x = d;
			y = u;
		}

		@Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
			int x1 = y - x;
			int x2 = o.y - o.x;
			return x1 - x2;
		}

	}

} Main
import java.util.*;
import java.awt.Frame;
import java.io.*;

public class Main {
	// static ArrayList<Integer>[] g;

	static pair[] a;
	static int[][] memo;

	static int dp(int l, int r) {
		if (l > r)
			return 0;
		if (memo[l][r] != -1)
			return memo[l][r];
		int ans = dp(l + 1, r);
		ans = Math.max(ans, dp(l, r - 1));
		for (int idx : startAt[l]) {
			if (a[idx].y >= r)
				continue;
			int inc = exist[a[idx].y + 1][r] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}
		for (int idx : endAt[r]) {
			if (a[idx].x <= l)
				continue;
			int inc = exist[l][a[idx].x - 1] ? 1 : 0;
			ans = Math.max(ans, 1 + dp(a[idx].x, a[idx].y) + inc + dp(a[idx].y + 1, r));
		}

		return memo[l][r] = ans;
	}

	public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);

		char[] s=br.readLine().toCharArray();
		char[] t=br.readLine().toCharArray();
		int min=Integer.MAX_VALUE;
		for (int i = 0; i+t.length <= s.length; i++) {
			int c=0;
			for (int j = 0; j <t.length ; j++) {
				if(t[j]!=s[i+j])
					c++;
			}
			min=Math.min(min, c);
		}
		pw.println(min);
		pw.flush();
		pw.close();

	}

	static ArrayList<Integer> primes;
	static int[] isComposite;

	static void sieve(int N) // O(N log log N)
	{
		isComposite = new int[N + 1];
		isComposite[0] = isComposite[1] = 1; // 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			}
	}

	static long pow(long a, long e, int mod) // O(log e)
	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1) {
				res *= a;
				res %= mod;
			}
			a *= a;
			a %= mod;
			e >>= 1;
		}
		return res;
	}

	static int maxSize;
	static boolean[][] exist;
	static ArrayList<Integer>[] startAt, endAt;

	static void compress(pair[] arr) {
		TreeSet<Integer> tr = new TreeSet<>();
		for (int i = 0; i < arr.length; i++) {
			tr.add(arr[i].x);
			tr.add(arr[i].y);
		}
		tr.add(0);
		tr.add((int) 1e9);
		HashMap<Integer, Integer> hm = new HashMap<>();
		for (int x : tr)
			hm.put(x, hm.size());
		for (int i = 0; i < arr.length; i++) {
			arr[i].x = hm.get(arr[i].x);
			arr[i].y = hm.get(arr[i].y);
		}
		maxSize = hm.size();
	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int u) {
			x = d;
			y = u;
		}

		@Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
			int x1 = y - x;
			int x2 = o.y - o.x;
			return x1 - x2;
		}

	}

}