import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		String s = fs.next();
		String t = fs.next();
		int min = Integer.MAX_VALUE;
		
		for(int i = 0;i<=s.length()-t.length();i++) {
			String k = s.substring(i,i+t.length());
			int count =0;
			for(int j =0 ;j<t.length();j++) {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			}
			
			if(min>count) min = count;
			
		}
		
		System.out.println(min);
		
		
		
	}
	
	

	static final Random random=new Random();
	
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

	
}


class node{
	int data;
	node next;

	node(int data){
		this.data=data;
	}
}

class Methods{
	node head;
	int size =0 ;
	void insert(int data) {
		node n = new node(data);
		size++;
		if(head==null) {
			head= n;
		}
		else {
			node k = head;
			while(k.next!=null) {
				k=k.next;
			}
			
			k.next=n;
		}
		
	}

	void print() {
		node n = head;
		while(n.next!=null) {
			System.out.print(n.data+" ");
			n=n.next;
		}
		System.out.println(n.data);
		
	}
	
	void isLoop(int x) {
		
		System.out.println(size - x +1);
		
		node n = head;
		
		while(n.next!=null && x-->2 ) {
			n=n.next;
		}
		
		n.next=n.next.next;
		
	}
	
	
}

 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.Random; Random java.util import java.util.StringTokenizer; StringTokenizer java.util public class Main {

	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		String s = fs.next();
		String t = fs.next();
		int min = Integer.MAX_VALUE;
		
		for(int i = 0;i<=s.length()-t.length();i++) {
			String k = s.substring(i,i+t.length());
			int count =0;
			for(int j =0 ;j<t.length();j++) {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			}
			
			if(min>count) min = count;
			
		}
		
		System.out.println(min);
		
		
		
	}
	
	

	static final Random random=new Random();
	
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

	
} Main static final Random random=new Random(); random new Random() public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		String s = fs.next();
		String t = fs.next();
		int min = Integer.MAX_VALUE;
		
		for(int i = 0;i<=s.length()-t.length();i++) {
			String k = s.substring(i,i+t.length());
			int count =0;
			for(int j =0 ;j<t.length();j++) {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			}
			
			if(min>count) min = count;
			
		}
		
		System.out.println(min);
		
		
		
	} main {
		FastScanner fs=new FastScanner();
		String s = fs.next();
		String t = fs.next();
		int min = Integer.MAX_VALUE;
		
		for(int i = 0;i<=s.length()-t.length();i++) {
			String k = s.substring(i,i+t.length());
			int count =0;
			for(int j =0 ;j<t.length();j++) {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			}
			
			if(min>count) min = count;
			
		}
		
		System.out.println(min);
		
		
		
	} FastScanner fs=new FastScanner(); fs new FastScanner() String s = fs.next(); s fs.next() fs.next fs String t = fs.next(); t fs.next() fs.next fs int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0;i<=s.length()-t.length();i++) {
			String k = s.substring(i,i+t.length());
			int count =0;
			for(int j =0 ;j<t.length();j++) {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			}
			
			if(min>count) min = count;
			
		} int i = 0; int i = 0; i 0 i<=s.length()-t.length() i s.length()-t.length() s.length() s.length s t.length() t.length t i++ i++ i {
			String k = s.substring(i,i+t.length());
			int count =0;
			for(int j =0 ;j<t.length();j++) {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			}
			
			if(min>count) min = count;
			
		} {
			String k = s.substring(i,i+t.length());
			int count =0;
			for(int j =0 ;j<t.length();j++) {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			}
			
			if(min>count) min = count;
			
		} String k = s.substring(i,i+t.length()); k s.substring(i,i+t.length()) s.substring s i i+t.length() i t.length() t.length t int count =0; count 0 for(int j =0 ;j<t.length();j++) {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			} int j =0 ; int j =0 ; j 0 j<t.length() j t.length() t.length t j++ j++ j {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			} {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			} if(t.charAt(j)!=k.charAt(j)) count++; t.charAt(j)!=k.charAt(j) t.charAt(j) t.charAt t j k.charAt(j) k.charAt k j count++ count if(min>count) min = count; min>count min count min = count min count System.out.println(min) System.out.println System.out System System.out min String[] args args static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	} ruffleSort {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	} int n=a.length; n a.length a a.length for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		} {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		} int oi=random.nextInt(n) oi random.nextInt(n) random.nextInt random n temp=a[oi]; temp a[oi] a oi a[oi]=a[i] a[oi] a oi a[i] a i a[i]=temp a[i] a i temp Arrays.sort(a) Arrays.sort Arrays a int[] a a static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	} FastScanner BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st=new StringTokenizer(""); st new StringTokenizer("") String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		} next {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		} while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				} !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				} catch (IOException e) {
					e.printStackTrace();
				} IOException e {
					e.printStackTrace();
				} e.printStackTrace() e.printStackTrace e {
					st=new StringTokenizer(br.readLine());
				} st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() {
			return Integer.parseInt(next());
		} nextInt {
			return Integer.parseInt(next());
		} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		} readArray {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		} int[] a=new int[n]; a new int[n] n for (int i=0; i<n; i++) a[i]=nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i a[i]=nextInt(); a[i]=nextInt() a[i] a i nextInt() nextInt return a; a int n n long nextLong() {
			return Long.parseLong(next());
		} nextLong {
			return Long.parseLong(next());
		} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next class node{
	int data;
	node next;

	node(int data){
		this.data=data;
	}
} node int data; data node next; next node(int data){
		this.data=data;
	} node {
		this.data=data;
	} this.data=data this.data this this.data data int data data class Methods{
	node head;
	int size =0 ;
	void insert(int data) {
		node n = new node(data);
		size++;
		if(head==null) {
			head= n;
		}
		else {
			node k = head;
			while(k.next!=null) {
				k=k.next;
			}
			
			k.next=n;
		}
		
	}

	void print() {
		node n = head;
		while(n.next!=null) {
			System.out.print(n.data+" ");
			n=n.next;
		}
		System.out.println(n.data);
		
	}
	
	void isLoop(int x) {
		
		System.out.println(size - x +1);
		
		node n = head;
		
		while(n.next!=null && x-->2 ) {
			n=n.next;
		}
		
		n.next=n.next.next;
		
	}
	
	
} Methods node head; head int size =0 ; size 0 void insert(int data) {
		node n = new node(data);
		size++;
		if(head==null) {
			head= n;
		}
		else {
			node k = head;
			while(k.next!=null) {
				k=k.next;
			}
			
			k.next=n;
		}
		
	} insert {
		node n = new node(data);
		size++;
		if(head==null) {
			head= n;
		}
		else {
			node k = head;
			while(k.next!=null) {
				k=k.next;
			}
			
			k.next=n;
		}
		
	} node n = new node(data); n new node(data) size++ size if(head==null) {
			head= n;
		}
		else {
			node k = head;
			while(k.next!=null) {
				k=k.next;
			}
			
			k.next=n;
		} head==null head null {
			head= n;
		} head= n head n {
			node k = head;
			while(k.next!=null) {
				k=k.next;
			}
			
			k.next=n;
		} node k = head; k head while(k.next!=null) {
				k=k.next;
			} k.next!=null k.next k k.next null {
				k=k.next;
			} k=k.next k k.next k k.next k.next=n k.next k k.next n int data data void print() {
		node n = head;
		while(n.next!=null) {
			System.out.print(n.data+" ");
			n=n.next;
		}
		System.out.println(n.data);
		
	} print {
		node n = head;
		while(n.next!=null) {
			System.out.print(n.data+" ");
			n=n.next;
		}
		System.out.println(n.data);
		
	} node n = head; n head while(n.next!=null) {
			System.out.print(n.data+" ");
			n=n.next;
		} n.next!=null n.next n n.next null {
			System.out.print(n.data+" ");
			n=n.next;
		} System.out.print(n.data+" ") System.out.print System.out System System.out n.data+" " n.data n n.data " " n=n.next n n.next n n.next System.out.println(n.data) System.out.println System.out System System.out n.data n n.data void isLoop(int x) {
		
		System.out.println(size - x +1);
		
		node n = head;
		
		while(n.next!=null && x-->2 ) {
			n=n.next;
		}
		
		n.next=n.next.next;
		
	} isLoop {
		
		System.out.println(size - x +1);
		
		node n = head;
		
		while(n.next!=null && x-->2 ) {
			n=n.next;
		}
		
		n.next=n.next.next;
		
	} System.out.println(size - x +1) System.out.println System.out System System.out size - x +1 size - x size x 1 node n = head; n head while(n.next!=null && x-->2 ) {
			n=n.next;
		} n.next!=null && x-->2 n.next!=null n.next n n.next null x-->2 x-- x 2 {
			n=n.next;
		} n=n.next n n.next n n.next n.next=n.next.next n.next n n.next n.next.next n.next n n.next n.next.next int x x public class Main {

	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		String s = fs.next();
		String t = fs.next();
		int min = Integer.MAX_VALUE;
		
		for(int i = 0;i<=s.length()-t.length();i++) {
			String k = s.substring(i,i+t.length());
			int count =0;
			for(int j =0 ;j<t.length();j++) {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			}
			
			if(min>count) min = count;
			
		}
		
		System.out.println(min);
		
		
		
	}
	
	

	static final Random random=new Random();
	
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

	
} public class Main {

	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		String s = fs.next();
		String t = fs.next();
		int min = Integer.MAX_VALUE;
		
		for(int i = 0;i<=s.length()-t.length();i++) {
			String k = s.substring(i,i+t.length());
			int count =0;
			for(int j =0 ;j<t.length();j++) {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			}
			
			if(min>count) min = count;
			
		}
		
		System.out.println(min);
		
		
		
	}
	
	

	static final Random random=new Random();
	
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

	
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		String s = fs.next();
		String t = fs.next();
		int min = Integer.MAX_VALUE;
		
		for(int i = 0;i<=s.length()-t.length();i++) {
			String k = s.substring(i,i+t.length());
			int count =0;
			for(int j =0 ;j<t.length();j++) {
				if(t.charAt(j)!=k.charAt(j)) count++;
				
			}
			
			if(min>count) min = count;
			
		}
		
		System.out.println(min);
		
		
		
	}
	
	

	static final Random random=new Random();
	
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

	
}


class node{
	int data;
	node next;

	node(int data){
		this.data=data;
	}
}

class Methods{
	node head;
	int size =0 ;
	void insert(int data) {
		node n = new node(data);
		size++;
		if(head==null) {
			head= n;
		}
		else {
			node k = head;
			while(k.next!=null) {
				k=k.next;
			}
			
			k.next=n;
		}
		
	}

	void print() {
		node n = head;
		while(n.next!=null) {
			System.out.print(n.data+" ");
			n=n.next;
		}
		System.out.println(n.data);
		
	}
	
	void isLoop(int x) {
		
		System.out.println(size - x +1);
		
		node n = head;
		
		while(n.next!=null && x-->2 ) {
			n=n.next;
		}
		
		n.next=n.next.next;
		
	}
	
	
}


