#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t, test;
  long long yay = 0, whoops = 0;
  size_t yes, no;
  string::iterator it;
  getline(cin, s);
  getline(cin, t);
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  it = t.begin();
  for (size_t i = 0; i != s.length(); ++i) {
    while (s[i] > *it && it != t.end()) {
      ++it;
    }
    if (it == t.end()) {
      if (isupper(s[i]))
        test.push_back(tolower(s[i]));
      else
        test.push_back(toupper(s[i]));
      continue;
    }
    if (s[i] == *it) {
      ++yay;
      *it = '*';
    } else {
      if (isupper(s[i]))
        test.push_back(tolower(s[i]));
      else
        test.push_back(toupper(s[i]));
    }
  }
  sort(test.begin(), test.end());
  it = t.begin();
  for (size_t i = 0; i != test.length(); ++i) {
    while (test[i] > *it && it != t.end()) {
      ++it;
    }
    if (it == t.end()) break;
    if (test[i] == *it) {
      ++whoops;
      *it = '*';
    }
  }
  cout << yay << " " << whoops << endl;
  return 0;
}
