lines = STDIN.read.split

lines.each_slice(2) do |a, b|
  s = a.chomp
  t = b.chomp

  ans = 0
  s.chars.each_with_index do |sch, si|
    len = 0
    t.chars.each_with_index do |tch, ti|
      if sch == tch
        len += 1
      else
        ans = [ans, len].max
      end
    end
    ans = [ans, len].max
  end

  puts ans
end