import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int max = 0;
		for(int i=0;i<s.length();i++){
			int n = 0;
			for(int j=0;j<t.length()&&i+t.length()<=s.length();j++){
				if(s.charAt(i+j) == t.charAt(j)){
					n++;
				}
			}
			if(max < n){
				max = n;
			}
		}
		System.out.println(t.length()-max);
		sc.close();
	}
}
 import java.util.Scanner; Scanner java.util class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int max = 0;
		for(int i=0;i<s.length();i++){
			int n = 0;
			for(int j=0;j<t.length()&&i+t.length()<=s.length();j++){
				if(s.charAt(i+j) == t.charAt(j)){
					n++;
				}
			}
			if(max < n){
				max = n;
			}
		}
		System.out.println(t.length()-max);
		sc.close();
	}
} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int max = 0;
		for(int i=0;i<s.length();i++){
			int n = 0;
			for(int j=0;j<t.length()&&i+t.length()<=s.length();j++){
				if(s.charAt(i+j) == t.charAt(j)){
					n++;
				}
			}
			if(max < n){
				max = n;
			}
		}
		System.out.println(t.length()-max);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int max = 0;
		for(int i=0;i<s.length();i++){
			int n = 0;
			for(int j=0;j<t.length()&&i+t.length()<=s.length();j++){
				if(s.charAt(i+j) == t.charAt(j)){
					n++;
				}
			}
			if(max < n){
				max = n;
			}
		}
		System.out.println(t.length()-max);
		sc.close();
	} 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 max = 0; max 0 for(int i=0;i<s.length();i++){
			int n = 0;
			for(int j=0;j<t.length()&&i+t.length()<=s.length();j++){
				if(s.charAt(i+j) == t.charAt(j)){
					n++;
				}
			}
			if(max < n){
				max = n;
			}
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			int n = 0;
			for(int j=0;j<t.length()&&i+t.length()<=s.length();j++){
				if(s.charAt(i+j) == t.charAt(j)){
					n++;
				}
			}
			if(max < n){
				max = n;
			}
		} {
			int n = 0;
			for(int j=0;j<t.length()&&i+t.length()<=s.length();j++){
				if(s.charAt(i+j) == t.charAt(j)){
					n++;
				}
			}
			if(max < n){
				max = n;
			}
		} int n = 0; n 0 for(int j=0;j<t.length()&&i+t.length()<=s.length();j++){
				if(s.charAt(i+j) == t.charAt(j)){
					n++;
				}
			} int j=0; int j=0; j 0 j<t.length()&&i+t.length()<=s.length() j<t.length() j t.length() t.length t i+t.length()<=s.length() i+t.length() i t.length() t.length t s.length() s.length s j++ j++ j {
				if(s.charAt(i+j) == t.charAt(j)){
					n++;
				}
			} {
				if(s.charAt(i+j) == t.charAt(j)){
					n++;
				}
			} if(s.charAt(i+j) == t.charAt(j)){
					n++;
				} 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 {
					n++;
				} n++ n if(max < n){
				max = n;
			} max < n max n {
				max = n;
			} max = n max n System.out.println(t.length()-max) System.out.println System.out System System.out t.length()-max t.length() t.length t max sc.close() sc.close sc String args[] args
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int max = 0;
		for(int i=0;i<s.length();i++){
			int n = 0;
			for(int j=0;j<t.length()&&i+t.length()<=s.length();j++){
				if(s.charAt(i+j) == t.charAt(j)){
					n++;
				}
			}
			if(max < n){
				max = n;
			}
		}
		System.out.println(t.length()-max);
		sc.close();
	}
}

