
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int m = t.length();
		for( int i=0 ; i<s.length()-t.length()+1 ; i++ ) {
			int c=0;
			for( int j = 0; j<t.length() ; j++ ) {
				if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				}
			}
			if( m > c ) {
				m = c;
			}
		}
		
		System.out.println(m);
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int m = t.length();
		for( int i=0 ; i<s.length()-t.length()+1 ; i++ ) {
			int c=0;
			for( int j = 0; j<t.length() ; j++ ) {
				if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				}
			}
			if( m > c ) {
				m = c;
			}
		}
		
		System.out.println(m);
	}
} Main public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int m = t.length();
		for( int i=0 ; i<s.length()-t.length()+1 ; i++ ) {
			int c=0;
			for( int j = 0; j<t.length() ; j++ ) {
				if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				}
			}
			if( m > c ) {
				m = c;
			}
		}
		
		System.out.println(m);
	} main {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int m = t.length();
		for( int i=0 ; i<s.length()-t.length()+1 ; i++ ) {
			int c=0;
			for( int j = 0; j<t.length() ; j++ ) {
				if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				}
			}
			if( m > c ) {
				m = c;
			}
		}
		
		System.out.println(m);
	} 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 m = t.length(); m t.length() t.length t for( int i=0 ; i<s.length()-t.length()+1 ; i++ ) {
			int c=0;
			for( int j = 0; j<t.length() ; j++ ) {
				if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				}
			}
			if( m > c ) {
				m = c;
			}
		} 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 c=0;
			for( int j = 0; j<t.length() ; j++ ) {
				if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				}
			}
			if( m > c ) {
				m = c;
			}
		} {
			int c=0;
			for( int j = 0; j<t.length() ; j++ ) {
				if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				}
			}
			if( m > c ) {
				m = c;
			}
		} int c=0; c 0 for( int j = 0; j<t.length() ; j++ ) {
				if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				}
			} 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)) {
					c++;
				}
			} {
				if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				}
			} if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				} 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 {
					c++;
				} c++ c if( m > c ) {
				m = c;
			} m > c m c {
				m = c;
			} m = c m c System.out.println(m) System.out.println System.out System System.out m String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int m = t.length();
		for( int i=0 ; i<s.length()-t.length()+1 ; i++ ) {
			int c=0;
			for( int j = 0; j<t.length() ; j++ ) {
				if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				}
			}
			if( m > c ) {
				m = c;
			}
		}
		
		System.out.println(m);
	}
} public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int m = t.length();
		for( int i=0 ; i<s.length()-t.length()+1 ; i++ ) {
			int c=0;
			for( int j = 0; j<t.length() ; j++ ) {
				if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				}
			}
			if( m > c ) {
				m = c;
			}
		}
		
		System.out.println(m);
	}
} Main

import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int m = t.length();
		for( int i=0 ; i<s.length()-t.length()+1 ; i++ ) {
			int c=0;
			for( int j = 0; j<t.length() ; j++ ) {
				if( s.charAt(i+j) != t.charAt(j)) {
					c++;
				}
			}
			if( m > c ) {
				m = c;
			}
		}
		
		System.out.println(m);
	}
}
