#include <bits/stdc++.h>
using namespace std;
int z[256];
bool used[300000];
int main() {
  string second, t;
  cin >> second >> t;
  int a = 0, b = 0;
  for (int i = 0; i < t.size(); i++) {
    z[t[i]]++;
  }
  sort(second.begin(), second.end());
  for (int i = 0; i < second.size(); i++) {
    if (z[second[i]]) {
      used[i] = true;
      a++;
      z[second[i]]--;
    }
  }
  for (int i = 0; i < second.size(); i++) {
    if (!used[i])
      if (second[i] < 'a') {
        if (z[second[i] + 32]) {
          b++;
          z[second[i] + 32]--;
        }
      } else if (second[i] >= 'a') {
        if (z[second[i] - 32]) {
          b++;
          z[second[i] - 32]--;
        }
      }
  }
  cout << a << " " << b;
}
