import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		if(S.contains(T))
		{
			System.out.println(0);
		}
		else
		{
			char[] sArray = S.toCharArray();
			char[] tArray = T.toCharArray();

			int lengthDiff = S.length()-T.length() + 1;
			//System.out.println(String.format("lengthDiff = {0}", S.length()-T.length()));

			int maxSameCharCount = 0;

			for(int i=0; i<lengthDiff;i++)
			{
				int sameCharCounter=0;
				for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				}

				if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				}
				//System.out.println();
			}

			System.out.println(T.length()-maxSameCharCount);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		if(S.contains(T))
		{
			System.out.println(0);
		}
		else
		{
			char[] sArray = S.toCharArray();
			char[] tArray = T.toCharArray();

			int lengthDiff = S.length()-T.length() + 1;
			//System.out.println(String.format("lengthDiff = {0}", S.length()-T.length()));

			int maxSameCharCount = 0;

			for(int i=0; i<lengthDiff;i++)
			{
				int sameCharCounter=0;
				for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				}

				if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				}
				//System.out.println();
			}

			System.out.println(T.length()-maxSameCharCount);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		if(S.contains(T))
		{
			System.out.println(0);
		}
		else
		{
			char[] sArray = S.toCharArray();
			char[] tArray = T.toCharArray();

			int lengthDiff = S.length()-T.length() + 1;
			//System.out.println(String.format("lengthDiff = {0}", S.length()-T.length()));

			int maxSameCharCount = 0;

			for(int i=0; i<lengthDiff;i++)
			{
				int sameCharCounter=0;
				for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				}

				if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				}
				//System.out.println();
			}

			System.out.println(T.length()-maxSameCharCount);
		}
	} main {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		if(S.contains(T))
		{
			System.out.println(0);
		}
		else
		{
			char[] sArray = S.toCharArray();
			char[] tArray = T.toCharArray();

			int lengthDiff = S.length()-T.length() + 1;
			//System.out.println(String.format("lengthDiff = {0}", S.length()-T.length()));

			int maxSameCharCount = 0;

			for(int i=0; i<lengthDiff;i++)
			{
				int sameCharCounter=0;
				for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				}

				if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				}
				//System.out.println();
			}

			System.out.println(T.length()-maxSameCharCount);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc if(S.contains(T))
		{
			System.out.println(0);
		}
		else
		{
			char[] sArray = S.toCharArray();
			char[] tArray = T.toCharArray();

			int lengthDiff = S.length()-T.length() + 1;
			//System.out.println(String.format("lengthDiff = {0}", S.length()-T.length()));

			int maxSameCharCount = 0;

			for(int i=0; i<lengthDiff;i++)
			{
				int sameCharCounter=0;
				for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				}

				if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				}
				//System.out.println();
			}

			System.out.println(T.length()-maxSameCharCount);
		} S.contains(T) S.contains S T {
			System.out.println(0);
		} System.out.println(0) System.out.println System.out System System.out 0 {
			char[] sArray = S.toCharArray();
			char[] tArray = T.toCharArray();

			int lengthDiff = S.length()-T.length() + 1;
			//System.out.println(String.format("lengthDiff = {0}", S.length()-T.length()));

			int maxSameCharCount = 0;

			for(int i=0; i<lengthDiff;i++)
			{
				int sameCharCounter=0;
				for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				}

				if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				}
				//System.out.println();
			}

			System.out.println(T.length()-maxSameCharCount);
		} char[] sArray = S.toCharArray(); sArray S.toCharArray() S.toCharArray S char[] tArray = T.toCharArray(); tArray T.toCharArray() T.toCharArray T int lengthDiff = S.length()-T.length() + 1; lengthDiff S.length()-T.length() + 1 S.length()-T.length() S.length() S.length S T.length() T.length T 1 int maxSameCharCount = 0; maxSameCharCount 0 for(int i=0; i<lengthDiff;i++)
			{
				int sameCharCounter=0;
				for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				}

				if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				}
				//System.out.println();
			} int i=0; int i=0; i 0 i<lengthDiff i lengthDiff i++ i++ i {
				int sameCharCounter=0;
				for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				}

				if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				}
				//System.out.println();
			} {
				int sameCharCounter=0;
				for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				}

				if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				}
				//System.out.println();
			} int sameCharCounter=0; sameCharCounter 0 for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				} int j=0; int j=0; j 0 j<tArray.length j tArray.length tArray tArray.length j++ j++ j {
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				} {
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				} if(sArray[i+j] == tArray[j]) sameCharCounter++; sArray[i+j] == tArray[j] sArray[i+j] sArray i+j i j tArray[j] tArray j sameCharCounter++ sameCharCounter if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				} maxSameCharCount < sameCharCounter maxSameCharCount sameCharCounter {
					maxSameCharCount = sameCharCounter;
				} maxSameCharCount = sameCharCounter maxSameCharCount sameCharCounter System.out.println(T.length()-maxSameCharCount) System.out.println System.out System System.out T.length()-maxSameCharCount T.length() T.length T maxSameCharCount String[] args args public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		if(S.contains(T))
		{
			System.out.println(0);
		}
		else
		{
			char[] sArray = S.toCharArray();
			char[] tArray = T.toCharArray();

			int lengthDiff = S.length()-T.length() + 1;
			//System.out.println(String.format("lengthDiff = {0}", S.length()-T.length()));

			int maxSameCharCount = 0;

			for(int i=0; i<lengthDiff;i++)
			{
				int sameCharCounter=0;
				for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				}

				if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				}
				//System.out.println();
			}

			System.out.println(T.length()-maxSameCharCount);
		}
	}
} public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		if(S.contains(T))
		{
			System.out.println(0);
		}
		else
		{
			char[] sArray = S.toCharArray();
			char[] tArray = T.toCharArray();

			int lengthDiff = S.length()-T.length() + 1;
			//System.out.println(String.format("lengthDiff = {0}", S.length()-T.length()));

			int maxSameCharCount = 0;

			for(int i=0; i<lengthDiff;i++)
			{
				int sameCharCounter=0;
				for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				}

				if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				}
				//System.out.println();
			}

			System.out.println(T.length()-maxSameCharCount);
		}
	}
} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		if(S.contains(T))
		{
			System.out.println(0);
		}
		else
		{
			char[] sArray = S.toCharArray();
			char[] tArray = T.toCharArray();

			int lengthDiff = S.length()-T.length() + 1;
			//System.out.println(String.format("lengthDiff = {0}", S.length()-T.length()));

			int maxSameCharCount = 0;

			for(int i=0; i<lengthDiff;i++)
			{
				int sameCharCounter=0;
				for(int j=0; j<tArray.length;j++)
				{
					//System.out.println("sArray[i+j]" + sArray[i+j]);
					//System.out.println("tArray[j]" + tArray[j]);

					if(sArray[i+j] == tArray[j]) sameCharCounter++;
				}

				if(maxSameCharCount < sameCharCounter)
				{
					maxSameCharCount = sameCharCounter;
				}
				//System.out.println();
			}

			System.out.println(T.length()-maxSameCharCount);
		}
	}
}
