function Main(input) {
  const line = input.split('\n');
  const s = line[0];
  const t = line[1];

  let tmp = '';
  let c = 0;
  let m = 0;
  for (let i = 0; i < t.length; ++i) {
    let w = t[i];
    tmp += w;
    if (s.indexOf(tmp) - i >= 0) {
      ++c;
      if (c > m) {
        m = c;
      }
    } else {
      tmp = '';
      c = 0;
    }
  }
  console.log(t.length - m);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
