#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b, c = "";
  long w, sla, slb, r = 0;
  string::iterator low;
  (cin >> a);
  ;
  (cin >> b);
  ;
  sla = a.length();
  slb = b.length();
  sort((a).begin(), (a).end());
  sort((b).begin(), (b).end());
  for (auto i = ((long)0); i < (sla); i++) {
    low = lower_bound((b).begin(), (b).end(), a[i]);
    w = low - b.begin();
    if (w != slb) {
      if (b[w] == a[i]) {
        r++;
        b.erase(low);
        slb--;
        continue;
      }
    }
    if (a[i] >= 'a' && a[i] <= 'z')
      c.push_back(a[i] + ('A' - 'a'));
    else
      c.push_back(a[i] - ('A' - 'a'));
  }
  (cout << (r) << endl);
  sla -= r;
  r = 0;
  for (auto i = ((long)0); i < (sla); i++) {
    low = lower_bound((b).begin(), (b).end(), c[i]);
    w = low - b.begin();
    if (w != slb) {
      if (b[w] == c[i]) {
        r++;
        b.erase(low);
        slb--;
      }
    }
  }
  (cout << (r) << endl);
  return 0;
}
