import std.algorithm;
import std.bigint;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.meta;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


auto solve(string S, string T) {
    int ans;
    foreach (s, t; zip(S, T))
        if (s == t)
            ans++;
    return ans;
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    string S;
    S = input.front.to!string;
    input.popFront;

    string T;
    T = input.front.to!string;
    input.popFront;

    static if (is(ReturnType!solve == void))
        solve(S, T);
    else
        solve(S, T).writeln;
}
