#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<vector<char>> ans(3, vector<char>(3));
vector<vector<char>> guess(3, vector<char>(3));
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
cin >> ans[i][j];
}
}
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
cin >> guess[i][j];
}
}
int green = 0, yellow = 0;
vector<int> cnt_a(26), cnt_b(26);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (ans[i][j] == guess[i][j]) {
green++;
} else {
cnt_a[ans[i][j] - 'A'];
cnt_b[guess[i][j] - 'A'];
}
}
}
for (int i = 0; i < 26; i++) {
yellow += min(cnt_a[i], cnt_b[i]);
}
cout << green << endl << yellow << endl;
return 0;
}