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();
		 int min = Integer.MAX_VALUE;	 
		 for (int i = 0; i < S.length()-T.length()+1; i++) {
			 int count = 0;
			 for (int j= 0; j < T.length(); j++) {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 }
			 if(min > count) {
				 min = count;
			 }
		 }
		 System.out.print(min);
	}

} 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();
		 int min = Integer.MAX_VALUE;	 
		 for (int i = 0; i < S.length()-T.length()+1; i++) {
			 int count = 0;
			 for (int j= 0; j < T.length(); j++) {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 }
			 if(min > count) {
				 min = count;
			 }
		 }
		 System.out.print(min);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		 String S = sc.next();
		 String T = sc.next();
		 int min = Integer.MAX_VALUE;	 
		 for (int i = 0; i < S.length()-T.length()+1; i++) {
			 int count = 0;
			 for (int j= 0; j < T.length(); j++) {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 }
			 if(min > count) {
				 min = count;
			 }
		 }
		 System.out.print(min);
	} main {
		Scanner sc = new Scanner(System.in);
		 String S = sc.next();
		 String T = sc.next();
		 int min = Integer.MAX_VALUE;	 
		 for (int i = 0; i < S.length()-T.length()+1; i++) {
			 int count = 0;
			 for (int j= 0; j < T.length(); j++) {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 }
			 if(min > count) {
				 min = count;
			 }
		 }
		 System.out.print(min);
	} 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 int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < S.length()-T.length()+1; i++) {
			 int count = 0;
			 for (int j= 0; j < T.length(); j++) {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 }
			 if(min > count) {
				 min = count;
			 }
		 } int i = 0; int i = 0; i 0 i < S.length()-T.length()+1 i S.length()-T.length()+1 S.length()-T.length() S.length() S.length S T.length() T.length T 1 i++ i++ i {
			 int count = 0;
			 for (int j= 0; j < T.length(); j++) {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 }
			 if(min > count) {
				 min = count;
			 }
		 } {
			 int count = 0;
			 for (int j= 0; j < T.length(); j++) {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 }
			 if(min > count) {
				 min = count;
			 }
		 } int count = 0; count 0 for (int j= 0; j < T.length(); j++) {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 } int j= 0; int j= 0; j 0 j < T.length() j T.length() T.length T j++ j++ j {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 } {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 } if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 } S.charAt(i+j) != T.charAt(j) S.charAt(i+j) S.charAt S i+j i j T.charAt(j) T.charAt T j {
					 count++;
				 } count++ count if(min > count) {
				 min = count;
			 } min > count min count {
				 min = count;
			 } min = count min count System.out.print(min) System.out.print System.out System System.out min 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();
		 int min = Integer.MAX_VALUE;	 
		 for (int i = 0; i < S.length()-T.length()+1; i++) {
			 int count = 0;
			 for (int j= 0; j < T.length(); j++) {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 }
			 if(min > count) {
				 min = count;
			 }
		 }
		 System.out.print(min);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		 String S = sc.next();
		 String T = sc.next();
		 int min = Integer.MAX_VALUE;	 
		 for (int i = 0; i < S.length()-T.length()+1; i++) {
			 int count = 0;
			 for (int j= 0; j < T.length(); j++) {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 }
			 if(min > count) {
				 min = count;
			 }
		 }
		 System.out.print(min);
	}

} 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();
		 int min = Integer.MAX_VALUE;	 
		 for (int i = 0; i < S.length()-T.length()+1; i++) {
			 int count = 0;
			 for (int j= 0; j < T.length(); j++) {
				 if(S.charAt(i+j) != T.charAt(j)) {
					 count++;
				 }
			 }
			 if(min > count) {
				 min = count;
			 }
		 }
		 System.out.print(min);
	}

}
