#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  long long t = 1;
  while (t--) {
    string s, t;
    cin >> s >> t;
    long long i;
    long long n = s.length();
    long long nn = t.length();
    map<char, long long> m;
    long long a = 0, b = 0;
    for (i = 0; i < nn; i++) {
      m[t[i]]++;
    }
    long long vis[n];
    memset(vis, 0, sizeof(vis));
    for (i = 0; i < n; i++) {
      if (m.find(s[i]) == m.end()) {
        continue;
      } else {
        auto it = m.find(s[i]);
        long long count = (*it).second;
        if (count > 0) {
          a++;
          (*it).second--;
          vis[i] = 1;
        }
      }
    }
    for (i = 0; i < n; i++) {
      if (vis[i] == 0) {
        char cc = s[i];
        if (isupper(cc)) {
          cc = tolower(cc);
        } else {
          cc = toupper(cc);
        }
        auto it2 = m.find(cc);
        if (it2 == m.end()) {
          continue;
        }
        long long count = (*it2).second;
        if (count > 0) {
          b++;
          (*it2).second--;
        }
      }
    }
    cout << a << " " << b << "\n";
  }
  return 0;
}
