#include <bits/stdc++.h>
using namespace std;
string s;
string u;
int n, m, mans = 0, ans = 0;
int main() {
  cin >> s >> u;
  m = s.size();
  n = u.size();
  for (int i = 1; i < min(m, n); i++) {
    for (int j = 0; j < i; j++)
      if (s[j] == u[n - i + j]) ans++;
    mans = max(ans, mans);
    ans = 0;
    for (int j = m - i; j < m; j++)
      if (s[j] == u[j - m + i]) ans++;
    mans = max(ans, mans);
    ans = 0;
  }
  if (m < n)
    for (int i = 0; i <= n - m; i++) {
      for (int j = 0; j < m; j++)
        if (s[j] == u[j + i]) ans++;
      mans = max(ans, mans);
      ans = 0;
    }
  else
    for (int i = 0; i <= m - n; i++) {
      for (int j = 0; j < n; j++)
        if (u[j] == s[j + i]) ans++;
      mans = max(ans, mans);
      ans = 0;
    }
  cout << n - mans;
}
