loop do
  s = gets.chomp
  break unless s
  t = gets.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