def make2d(m,n)
  Array.new(m).map{Array.new(n,0)}
end


def min(x,y)
  if x > y
    return y
  else
    return x
  end
end


def g()
  1
end

def q(c,d)
   if c == d
       return 0
   else
       return 1
   end
end

def align_ed(s,t)
  m = s.length()
  n = t.length()
  a = make2d(m+1,n+1)                               #?????????????????¨??§a[m][n]?????§??????????????????
  a[0][0] = 0
  for j in 1..n
    a[0][j] = a[0][j-1] + g()
  end
  for i in 1..m
    a[i][0] = a[i-1][0] + g()
  end
  for i in 1..m 
    for j in 1..n
      x = a[i-1][j-1] + q(s[i-1],t[j-1])            #a[i][j]???ij???s???i????????¨t???j????????????????????????s???i????????¨t???j?????????????????????s[i-1],t[j-1]????????§???????????????????????????
      y = a[i][j-1] + g()                           
      z = a[i-1][j] + g()
      a[i][j] = min(x,min(y,z))
    end
  end
  a[-1][-1]
end
=begin
def traceback_ed(a,s,t)
  u = ""
  v = ""
  i = s.length()
  j = t.length()
  while i>0 || j>0
    if j>0 && a[i][j] == a[i][j-1] + g()
      u = "-"           + u
      v = t[j-1 .. j-1] + v
      j = j - 1 # go up
    else
      if i>0 && j>0 &&
         a[i][j] == a[i-1][j-1] + q(s[i-1], t[j-1])
        u = s[i-1 .. i-1] + u
        v = t[j-1 .. j-1] + v
        j = j - 1 # go up
        i = i - 1 # go left
        
        
      else
        if i>0 && a[i][j] == a[i-1][j] + g()
          u = s[i-1 .. i-1] + u
          v = "-"           + v
          i = i - 1 # go left
          
        end
      end
    end
  end
  [u,v]
end

def align_dp_ed(s,t)
  traceback_ed(align_ed(s,t),s,t)
end
=end

s1 = gets.chomp
s2 = gets.chomp
puts align_ed(s1,s2)