import java.awt.*;
import java.io.*;
import java.util.*;
 
public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new TestB().doIt();
	}
	class TestB{
		void doIt() {
			String S = sc.next();
			String T = sc.next();
			char SubT[] = T.toCharArray();
			int lengthS = S.length();
			int lengthT = T.length();
			int length = lengthS - lengthT;
			int min = 10000;
			for(int i = 0;i <= length;i++){
//				System.out.println(S.substring(i,i + lengthT));
				char SubS[] = S.substring(i,i + lengthT).toCharArray();
				int count = 0;
				for(int j = 0;j < lengthT;j++) {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				}
				min = Math.min(min,count);
			}
			System.out.println(min);
		}
	}
} import java.awt.*; awt.* java import java.io.*; io.* java import java.util.*; util.* java public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new TestB().doIt();
	}
	class TestB{
		void doIt() {
			String S = sc.next();
			String T = sc.next();
			char SubT[] = T.toCharArray();
			int lengthS = S.length();
			int lengthT = T.length();
			int length = lengthS - lengthT;
			int min = 10000;
			for(int i = 0;i <= length;i++){
//				System.out.println(S.substring(i,i + lengthT));
				char SubS[] = S.substring(i,i + lengthT).toCharArray();
				int count = 0;
				for(int j = 0;j < lengthT;j++) {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				}
				min = Math.min(min,count);
			}
			System.out.println(min);
		}
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){
		new Main();
	} main {
		new Main();
	} new Main() String[] args args public Main(){
		new TestB().doIt();
	} Main {
		new TestB().doIt();
	} new TestB().doIt() new TestB().doIt new TestB() class TestB{
		void doIt() {
			String S = sc.next();
			String T = sc.next();
			char SubT[] = T.toCharArray();
			int lengthS = S.length();
			int lengthT = T.length();
			int length = lengthS - lengthT;
			int min = 10000;
			for(int i = 0;i <= length;i++){
//				System.out.println(S.substring(i,i + lengthT));
				char SubS[] = S.substring(i,i + lengthT).toCharArray();
				int count = 0;
				for(int j = 0;j < lengthT;j++) {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				}
				min = Math.min(min,count);
			}
			System.out.println(min);
		}
	} TestB void doIt() {
			String S = sc.next();
			String T = sc.next();
			char SubT[] = T.toCharArray();
			int lengthS = S.length();
			int lengthT = T.length();
			int length = lengthS - lengthT;
			int min = 10000;
			for(int i = 0;i <= length;i++){
//				System.out.println(S.substring(i,i + lengthT));
				char SubS[] = S.substring(i,i + lengthT).toCharArray();
				int count = 0;
				for(int j = 0;j < lengthT;j++) {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				}
				min = Math.min(min,count);
			}
			System.out.println(min);
		} doIt {
			String S = sc.next();
			String T = sc.next();
			char SubT[] = T.toCharArray();
			int lengthS = S.length();
			int lengthT = T.length();
			int length = lengthS - lengthT;
			int min = 10000;
			for(int i = 0;i <= length;i++){
//				System.out.println(S.substring(i,i + lengthT));
				char SubS[] = S.substring(i,i + lengthT).toCharArray();
				int count = 0;
				for(int j = 0;j < lengthT;j++) {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				}
				min = Math.min(min,count);
			}
			System.out.println(min);
		} String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc char SubT[] = T.toCharArray(); SubT T.toCharArray() T.toCharArray T int lengthS = S.length(); lengthS S.length() S.length S int lengthT = T.length(); lengthT T.length() T.length T int length = lengthS - lengthT; length lengthS - lengthT lengthS lengthT int min = 10000; min 10000 for(int i = 0;i <= length;i++){
//				System.out.println(S.substring(i,i + lengthT));
				char SubS[] = S.substring(i,i + lengthT).toCharArray();
				int count = 0;
				for(int j = 0;j < lengthT;j++) {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				}
				min = Math.min(min,count);
			} int i = 0; int i = 0; i 0 i <= length i length i++ i++ i {
//				System.out.println(S.substring(i,i + lengthT));
				char SubS[] = S.substring(i,i + lengthT).toCharArray();
				int count = 0;
				for(int j = 0;j < lengthT;j++) {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				}
				min = Math.min(min,count);
			} {
//				System.out.println(S.substring(i,i + lengthT));
				char SubS[] = S.substring(i,i + lengthT).toCharArray();
				int count = 0;
				for(int j = 0;j < lengthT;j++) {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				}
				min = Math.min(min,count);
			} char SubS[] = S.substring(i,i + lengthT).toCharArray(); SubS S.substring(i,i + lengthT).toCharArray() S.substring(i,i + lengthT).toCharArray S.substring(i,i + lengthT) S.substring S i i + lengthT i lengthT int count = 0; count 0 for(int j = 0;j < lengthT;j++) {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				} int j = 0; int j = 0; j 0 j < lengthT j lengthT j++ j++ j {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				} {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				} if(SubS[j] != SubT[j]) {
						count++;
					} SubS[j] != SubT[j] SubS[j] SubS j SubT[j] SubT j {
						count++;
					} count++ count min = Math.min(min,count) min Math.min(min,count) Math.min Math min count System.out.println(min) System.out.println System.out System System.out min public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new TestB().doIt();
	}
	class TestB{
		void doIt() {
			String S = sc.next();
			String T = sc.next();
			char SubT[] = T.toCharArray();
			int lengthS = S.length();
			int lengthT = T.length();
			int length = lengthS - lengthT;
			int min = 10000;
			for(int i = 0;i <= length;i++){
//				System.out.println(S.substring(i,i + lengthT));
				char SubS[] = S.substring(i,i + lengthT).toCharArray();
				int count = 0;
				for(int j = 0;j < lengthT;j++) {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				}
				min = Math.min(min,count);
			}
			System.out.println(min);
		}
	}
} public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new TestB().doIt();
	}
	class TestB{
		void doIt() {
			String S = sc.next();
			String T = sc.next();
			char SubT[] = T.toCharArray();
			int lengthS = S.length();
			int lengthT = T.length();
			int length = lengthS - lengthT;
			int min = 10000;
			for(int i = 0;i <= length;i++){
//				System.out.println(S.substring(i,i + lengthT));
				char SubS[] = S.substring(i,i + lengthT).toCharArray();
				int count = 0;
				for(int j = 0;j < lengthT;j++) {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				}
				min = Math.min(min,count);
			}
			System.out.println(min);
		}
	}
} Main
import java.awt.*;
import java.io.*;
import java.util.*;
 
public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new TestB().doIt();
	}
	class TestB{
		void doIt() {
			String S = sc.next();
			String T = sc.next();
			char SubT[] = T.toCharArray();
			int lengthS = S.length();
			int lengthT = T.length();
			int length = lengthS - lengthT;
			int min = 10000;
			for(int i = 0;i <= length;i++){
//				System.out.println(S.substring(i,i + lengthT));
				char SubS[] = S.substring(i,i + lengthT).toCharArray();
				int count = 0;
				for(int j = 0;j < lengthT;j++) {
					if(SubS[j] != SubT[j]) {
						count++;
					}
				}
				min = Math.min(min,count);
			}
			System.out.println(min);
		}
	}
}