let S = readLine()!
let T = readLine()!
var times = 0
for i in 0..<S.count{
  if S[S.index(word.startIndex, offsetBy: i)] == T[T.index(word.startIndex, offsetBy: i)]{
    times += 1
  }
}
print(times)
