#include <iostream>
#include <vector>
#include <map>
using namespace std;
vector<string> A;
vector<string> B;
int main(void) {
string temp;
map<char, int> alphabet;
int yellow = 0, green = 0;
for (int i = 'A'; i <= 'Z'; ++i) {
alphabet[i] = 0;
}
for (int i = 0; i < 3; ++i) {
cin >> temp;
A.push_back(temp);
for (const char& c : temp) {
alphabet[c]++;
}
}
for (int i = 0; i < 3; ++i) {
cin >> temp;
B.push_back(temp);
}
for (int r = 0; r < 3; ++r) {
for (int c = 0; c < 3; ++c) {
if (A[r][c] == B[r][c]) {
green++;
alphabet[B[r][c]]--;
}
else if (alphabet[B[r][c]]) {
yellow++;
alphabet[B[r][c]]--;
}
}
}
cout << green << endl;
cout << yellow << endl;
return 0;
}