import java.util.*;
public class Main {

	public static int finddiff(String s, String t)
	{
		int res = 0;
		if(t.length()>s.length())
			return Integer.MAX_VALUE;
		for(int i=0;i<t.length();i++)
				if(t.charAt(i)!=s.charAt(i))
					res++;
		return res;
	}
	public static void main(String[] args) {		
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		int min = t.length();
		for(int i=0;i<=s.length()-t.length();i++)
		{
			int val = finddiff(s.substring(i),t);
			if(min>val)
				min = val;
		}
		System.out.println(min);
	}
// codeforces coderraces
} import java.util.*; util.* java public class Main {

	public static int finddiff(String s, String t)
	{
		int res = 0;
		if(t.length()>s.length())
			return Integer.MAX_VALUE;
		for(int i=0;i<t.length();i++)
				if(t.charAt(i)!=s.charAt(i))
					res++;
		return res;
	}
	public static void main(String[] args) {		
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		int min = t.length();
		for(int i=0;i<=s.length()-t.length();i++)
		{
			int val = finddiff(s.substring(i),t);
			if(min>val)
				min = val;
		}
		System.out.println(min);
	}
// codeforces coderraces
} Main public static int finddiff(String s, String t)
	{
		int res = 0;
		if(t.length()>s.length())
			return Integer.MAX_VALUE;
		for(int i=0;i<t.length();i++)
				if(t.charAt(i)!=s.charAt(i))
					res++;
		return res;
	} finddiff {
		int res = 0;
		if(t.length()>s.length())
			return Integer.MAX_VALUE;
		for(int i=0;i<t.length();i++)
				if(t.charAt(i)!=s.charAt(i))
					res++;
		return res;
	} int res = 0; res 0 if(t.length()>s.length())
			return Integer.MAX_VALUE; t.length()>s.length() t.length() t.length t s.length() s.length s return Integer.MAX_VALUE; Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i=0;i<t.length();i++)
				if(t.charAt(i)!=s.charAt(i))
					res++; int i=0; int i=0; i 0 i<t.length() i t.length() t.length t i++ i++ i if(t.charAt(i)!=s.charAt(i))
					res++; if(t.charAt(i)!=s.charAt(i))
					res++; t.charAt(i)!=s.charAt(i) t.charAt(i) t.charAt t i s.charAt(i) s.charAt s i res++ res return res; res String s s String t t public static void main(String[] args) {		
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		int min = t.length();
		for(int i=0;i<=s.length()-t.length();i++)
		{
			int val = finddiff(s.substring(i),t);
			if(min>val)
				min = val;
		}
		System.out.println(min);
	} main {		
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		int min = t.length();
		for(int i=0;i<=s.length()-t.length();i++)
		{
			int val = finddiff(s.substring(i),t);
			if(min>val)
				min = val;
		}
		System.out.println(min);
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) String s = scn.next(); s scn.next() scn.next scn String t = scn.next(); t scn.next() scn.next scn int min = t.length(); min t.length() t.length t for(int i=0;i<=s.length()-t.length();i++)
		{
			int val = finddiff(s.substring(i),t);
			if(min>val)
				min = val;
		} int i=0; int i=0; i 0 i<=s.length()-t.length() i s.length()-t.length() s.length() s.length s t.length() t.length t i++ i++ i {
			int val = finddiff(s.substring(i),t);
			if(min>val)
				min = val;
		} {
			int val = finddiff(s.substring(i),t);
			if(min>val)
				min = val;
		} int val = finddiff(s.substring(i),t); val finddiff(s.substring(i),t) finddiff s.substring(i) s.substring s i t if(min>val)
				min = val; min>val min val min = val min val System.out.println(min) System.out.println System.out System System.out min String[] args args public class Main {

	public static int finddiff(String s, String t)
	{
		int res = 0;
		if(t.length()>s.length())
			return Integer.MAX_VALUE;
		for(int i=0;i<t.length();i++)
				if(t.charAt(i)!=s.charAt(i))
					res++;
		return res;
	}
	public static void main(String[] args) {		
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		int min = t.length();
		for(int i=0;i<=s.length()-t.length();i++)
		{
			int val = finddiff(s.substring(i),t);
			if(min>val)
				min = val;
		}
		System.out.println(min);
	}
// codeforces coderraces
} public class Main {

	public static int finddiff(String s, String t)
	{
		int res = 0;
		if(t.length()>s.length())
			return Integer.MAX_VALUE;
		for(int i=0;i<t.length();i++)
				if(t.charAt(i)!=s.charAt(i))
					res++;
		return res;
	}
	public static void main(String[] args) {		
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		int min = t.length();
		for(int i=0;i<=s.length()-t.length();i++)
		{
			int val = finddiff(s.substring(i),t);
			if(min>val)
				min = val;
		}
		System.out.println(min);
	}
// codeforces coderraces
} Main
import java.util.*;
public class Main {

	public static int finddiff(String s, String t)
	{
		int res = 0;
		if(t.length()>s.length())
			return Integer.MAX_VALUE;
		for(int i=0;i<t.length();i++)
				if(t.charAt(i)!=s.charAt(i))
					res++;
		return res;
	}
	public static void main(String[] args) {		
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		int min = t.length();
		for(int i=0;i<=s.length()-t.length();i++)
		{
			int val = finddiff(s.substring(i),t);
			if(min>val)
				min = val;
		}
		System.out.println(min);
	}
// codeforces coderraces
}
