# coding: utf-8
class Case01

  def initialize
  end

  def show
    p self.instance_variables
        .map{ |sym| [sym, self.instance_variable_get(sym)] }
        .to_h
  end
  
  # 実行する
  def execute
    read
    solve
    output
  end

  # 読込
  def read
    @s = gets.chomp
    @t = gets.chomp
  end

  # 回答
  def solve
    @result = 0
    1.upto(3) do |i|
      @result += 1 if @s[i-1] == @t[i-1]
    end
  end
  
  # 出力
  def output
    puts @result
  end

end

Case01.new.execute if $0 == __FILE__

