#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, z, s1;
  cin >> s >> z;
  vector<int> v(256);
  for (int i = 0; i < z.size(); ++i) v[z[i]]++;
  int x = 0, y = 0;
  for (int i = 0; i < s.size(); ++i) {
    char c = s[i];
    if (v[c] > 0) {
      v[c]--;
      x++;
    } else if ('a' <= c && c <= 'z') {
      s1 += (char)(c + 'A' - 'a');
    } else {
      s1 += (char)(c - 'A' + 'a');
    }
  }
  for (int i = 0; i < s1.size(); ++i) {
    char c = s1[i];
    if (v[c] > 0) {
      v[c]--;
      y++;
    }
  }
  cout << x << ' ' << y << endl;
}
