#include <stdio.h>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    int N;
    char forecasts[3], real[3];
    scanf("%s", forecasts);
    scanf("%s", real);
    NSInteger hit = 0;
    for (int i=0;i<3;i++) {
        hit += (forecasts[i] == real[i]) ? 1 : 0;
    }
    
    return 0;
}
