Public Class Program
  Shared Sub Main()
    Dim s As String = Console.ReadLine()
    Dim t As String = Console.ReadLine()
    Dim ans As Integer = 0
    For i As Integer = 0 To 2
      If s(i) = t(i) Then ans += 1
    Next
    Console.WriteLine(ans.ToString())
  End Sub
End Class