import 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 ls = s.length();
		int lt = t.length();
		int ld = ls-lt;

		int chg = lt+1;
		for ( int i=0; i<=ld; i++ ) {
			int chg1 = lt;
			for ( int j=0; j<lt; j++ ) {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			}
			chg = Math.min(chg, chg1);
		}
		System.out.println(chg);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();

		int ls = s.length();
		int lt = t.length();
		int ld = ls-lt;

		int chg = lt+1;
		for ( int i=0; i<=ld; i++ ) {
			int chg1 = lt;
			for ( int j=0; j<lt; j++ ) {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			}
			chg = Math.min(chg, chg1);
		}
		System.out.println(chg);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();

		int ls = s.length();
		int lt = t.length();
		int ld = ls-lt;

		int chg = lt+1;
		for ( int i=0; i<=ld; i++ ) {
			int chg1 = lt;
			for ( int j=0; j<lt; j++ ) {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			}
			chg = Math.min(chg, chg1);
		}
		System.out.println(chg);
	} main {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();

		int ls = s.length();
		int lt = t.length();
		int ld = ls-lt;

		int chg = lt+1;
		for ( int i=0; i<=ld; i++ ) {
			int chg1 = lt;
			for ( int j=0; j<lt; j++ ) {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			}
			chg = Math.min(chg, chg1);
		}
		System.out.println(chg);
	} 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 ls = s.length(); ls s.length() s.length s int lt = t.length(); lt t.length() t.length t int ld = ls-lt; ld ls-lt ls lt int chg = lt+1; chg lt+1 lt 1 for ( int i=0; i<=ld; i++ ) {
			int chg1 = lt;
			for ( int j=0; j<lt; j++ ) {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			}
			chg = Math.min(chg, chg1);
		} int i=0; int i=0; i 0 i<=ld i ld i++ i++ i {
			int chg1 = lt;
			for ( int j=0; j<lt; j++ ) {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			}
			chg = Math.min(chg, chg1);
		} {
			int chg1 = lt;
			for ( int j=0; j<lt; j++ ) {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			}
			chg = Math.min(chg, chg1);
		} int chg1 = lt; chg1 lt for ( int j=0; j<lt; j++ ) {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			} int j=0; int j=0; j 0 j<lt j lt j++ j++ j {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			} {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			} if ( s.charAt(i+j)==t.charAt(j) ) chg1--; 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 chg1-- chg1 chg = Math.min(chg, chg1) chg Math.min(chg, chg1) Math.min Math chg chg1 System.out.println(chg) System.out.println System.out System System.out chg 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 ls = s.length();
		int lt = t.length();
		int ld = ls-lt;

		int chg = lt+1;
		for ( int i=0; i<=ld; i++ ) {
			int chg1 = lt;
			for ( int j=0; j<lt; j++ ) {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			}
			chg = Math.min(chg, chg1);
		}
		System.out.println(chg);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();

		int ls = s.length();
		int lt = t.length();
		int ld = ls-lt;

		int chg = lt+1;
		for ( int i=0; i<=ld; i++ ) {
			int chg1 = lt;
			for ( int j=0; j<lt; j++ ) {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			}
			chg = Math.min(chg, chg1);
		}
		System.out.println(chg);
	}
} Main
import 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 ls = s.length();
		int lt = t.length();
		int ld = ls-lt;

		int chg = lt+1;
		for ( int i=0; i<=ld; i++ ) {
			int chg1 = lt;
			for ( int j=0; j<lt; j++ ) {
				if ( s.charAt(i+j)==t.charAt(j) ) chg1--;
			}
			chg = Math.min(chg, chg1);
		}
		System.out.println(chg);
	}
}