Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The newspaper contains string t, consisting of uppercase and lowercase English letters. We know that the length of string t greater or equal to the length of the string s.

The newspaper may possibly have too few of some letters needed to make the text and too many of some other letters. That's why Tanya wants to cut some n letters out of the newspaper and make a message of length exactly n, so that it looked as much as possible like s. If the letter in some position has correct value and correct letter case (in the string s and in the string that Tanya will make), then she shouts joyfully "YAY!", and if the letter in the given position has only the correct value but it is in the wrong case, then the girl says "WHOOPS".

Tanya wants to make such message that lets her shout "YAY!" as much as possible. If there are multiple ways to do this, then her second priority is to maximize the number of times she says "WHOOPS". Your task is to help Tanya make the message.


-----Input-----

The first line contains line s (1 ≤ |s| ≤ 2·10^5), consisting of uppercase and lowercase English letters — the text of Tanya's message.

The second line contains line t (|s| ≤ |t| ≤ 2·10^5), consisting of uppercase and lowercase English letters — the text written in the newspaper.

Here |a| means the length of the string a.


-----Output-----

Print two integers separated by a space:  the first number is the number of times Tanya shouts "YAY!" while making the message,  the second number is the number of times Tanya says "WHOOPS" while making the message. 


-----Examples-----
Input
AbC
DCbA

Output
3 0

Input
ABC
abc

Output
0 3

Input
abacaba
AbaCaBA

Output
3 4

Difficulty: interview

Starter code:

Solutions:
def upc(c):
    if c >= 'a' and c <= 'z':
        c = chr(ord(c) - ord('a') + ord('A'))
    return c
a1, a2 = {}, {}
for i in input():
    if i in a1:
        a1[i] += 1
    else:
        a1[i] = 1
for i in input():
    if i in a2:
        a2[i] += 1
    else:
        a2[i] = 1
r1, r2 = 0, 0
a3, a4 = {}, {}
for k in a1:
    v = a1[k]
    if not k in a2:
        continue
    c = min(v, a2[k])
    a2[k] -= c
    a1[k] -= c
    r1 += c
for k in a1:
    v = a1[k]
    c = upc(k)
    if c in a3:
        a3[c] += v
    else:
        a3[c] = v
for k in a2:
    v = a2[k]
    c = upc(k)
    if c in a4:
        a4[c] += v
    else:
        a4[c] = v
for k in a3:
    if not k in a4:
        continue
    v = a3[k]
    c = min(v, a4[k])
    a3[k] -= c
    a4[k] -= c
    r2 += c
print(r1, r2)


__author__ = 'PrimuS'

s = input()
t = input()

sd = {}
td = {}

for x in s:
    sd[x] = sd.get(x, 0) + 1

for x in t:
    td[x] = td.get(x, 0) + 1

res1 = 0
res2 = 0

for x in sd.keys():
    if x not in td:
        continue
    k = min(sd[x], td[x])
    res1 += k
    sd[x] -= k
    td[x] -= k


for x in sd.keys():
    if x.islower():
        y = x.upper()
    else:
        y = x.lower()
    if y not in td:
        continue
    k = min(sd[x], td[y])
    sd[x] -= k
    td[y] -= k
    res2 += k

print(res1, res2)

def main():
    s, t = [0] * 123, [0] * 123
    for c in input():
        s[ord(c)] += 1
    for c in input():
        t[ord(c)] += 1
    yay = whoops = 0
    for i, x, y in zip(list(range(123)), s, t):
        if x > y:
            s[i] = x - y
            t[i] = 0
            yay += y
        else:
            s[i] = 0
            t[i] = y - x
            yay += x
    t[ord('A'):ord('Z') + 1], t[ord('a'):ord('z') + 1] = t[ord('a'):ord('z') + 1], t[ord('A'):ord('Z') + 1]
    for i, x, y in zip(list(range(123)), s, t):
        if x > y:
            s[i] = x - y
            t[i] = 0
            whoops += y
        else:
            s[i] = 0
            t[i] = y - x
            whoops += x
    print(yay, whoops)


def __starting_point():
    main()

__starting_point()

def foo():
    s = input()
    d = {}
    for key in s:
        d[key] = d.get(key, 0) + 1
    return d

def f(s):
    d = {}
    for key in list(s.keys()):
        if ord(key) > ord('Z'):
            c = chr(ord(key) - ord('a') + ord('A'))
            d[c] = d.get(c, 0) + s[key]
        else:
            d[key] = d.get(key, 0) + s[key]
    return d

s = foo()
t = foo()
yr = 0
op = 0
for key in list(s.keys()):
    element = min(s[key], t.get(key, 0))
    yr += element
    s[key] -= element
    if t.get(key):
        t[key] -= element 

s = f(s)
t = f(t)

for key in list(s.keys()):
    element = min(s[key], t.get(key, 0))
    op += element
    s[key] -= element
    if t.get(key):
        t[key] -= element 

print(yr, op)


from collections import Counter

i1 = input()
i2 = input()

s1 = Counter(i1)
s2 = Counter(i2)

intersect = s1 & s2

s1.subtract(intersect)
s2.subtract(intersect)

opa = Counter(''.join(s1.elements()).lower()) & Counter(''.join(s2.elements()).lower())

print(sum(intersect.values()), sum(opa.values()))


u = input()
v = input()
a = [0 for i in range(200)]
b = [0 for i in range(200)]
m = 0
n = 0
d = ord('a') - ord('A')
for i in u:
    a[ord(i)] += 1
for i in v:
    b[ord(i)] += 1
for i in range(ord('A'),ord('Z') + 1):
    r  = min(a[i], b[i]) + min(a[i + d], b[i + d])
    n += r
    m += min(a[i] + a[i + d], b[i] + b[i + d]) - r
print(n, m)

x = input()
t = input()
d = dict()
for i in t:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
s = []
for i in x:
    s.append([i, 0])
s.sort(reverse = True)
ura = 0
opa = 0
for i in range(len(s)):
    if s[i][0] in d:
        if d[s[i][0]] > 0:
            ura += 1
            s[i][1] = 1
            d[s[i][0]] -= 1
for i in range(len(s)):
    if chr(ord(s[i][0]) - ord('a') + ord('A')) in d and s[i][1] == 0:
        if d[chr(ord(s[i][0]) - ord('a') + ord('A'))] > 0:
            opa += 1
            s[i][1] = 1
            d[chr(ord(s[i][0]) - ord('a') + ord('A'))] -= 1
for i in range(len(s)):
    if chr(ord(s[i][0]) - ord('A') + ord('a')) in d and s[i][1] == 0:
        if d[chr(ord(s[i][0]) - ord('A') + ord('a'))] > 0:
            opa += 1
            s[i][1] = 1
            d[chr(ord(s[i][0]) - ord('A') + ord('a'))] -= 1
print(ura, opa)

def main():	
	s = (input())
	t = (input())

	arrS = [0] * 70
	arrT = [0] * 70
	count = 0
	count2 = 0
	n = len(s)
	for x in s:
		arrS[ord(x) - 65] += 1
	for x in t:
		arrT[ord(x) - 65] += 1
	for i in range(60):
		temp = min(arrS[i], arrT[i])
		arrS[i] -= temp
		arrT[i] -= temp
		count += temp
	for i in range(28):
		temp = min(arrS[i], arrT[i + 32])
		arrS[i] -= temp
		arrT[i + 32] -= temp
		count2 += temp
	for i in range(32, 68):
		temp = min(arrS[i], arrT[i - 32])
		arrS[i] -= temp
		arrT[i - 32] -= temp
		count2 += temp







	
	print(count, count2)



def __starting_point():
	main()
__starting_point()

s = input()
t = input()
s_letters = dict()
t_letters = dict()

CAPS =   'QWERTYUIOPASDFGHJKLZXCVBNM'
SMALLS = 'qwertyuiopasdfghjklzxcvbnm'

for letter in CAPS:
    s_letters[letter] = 0
    t_letters[letter] = 0
for letter in SMALLS:
    s_letters[letter] = 0
    t_letters[letter] = 0

for letter in s:
    s_letters[letter] += 1
for letter in t:
    t_letters[letter] += 1

hurray = 0
hopa = 0
for i in range(26):
    Letter = CAPS[i]
    letter = SMALLS[i]
    tmp = min(s_letters[Letter], t_letters[Letter])
    hurray += tmp
    s_letters[Letter] -= tmp
    t_letters[Letter] -= tmp
    tmp = min(s_letters[letter], t_letters[letter])
    hurray += tmp
    s_letters[letter] -= tmp
    t_letters[letter] -= tmp
    hopa += min(s_letters[Letter] + s_letters[letter], t_letters[Letter] + t_letters[letter])

print(hurray, hopa)

import math

s = input()
t = input()

lenS = len(s)
lenT = len(t)

yes = 0
no = 0

def change_register(l):
    if ord(l) > 96:
        return chr(ord(l) - 32)
    else:
        return chr(ord(l) + 32)


map1 = {}

for i in s:
    if map1.get(i, None) is None:
        map1[i] = 1
    else:
        map1[i] += 1

map2 = {}

for i in t:
    if map2.get(i, None) is None:
        map2[i] = 1
    else:
        map2[i] += 1


for i in map1:

    if (map1.get(i, None) is None) or (map2.get(i, None) is None):
        continue

    diff = map1[i] - map2.get(i, 0)

    if diff > 0:
        yes += map1[i] - diff
        map2[i] -= (map1[i] - diff)
        map1[i] -= (map1[i] - diff)
    else:
        yes += map1[i]
        map2[i] -= map1[i]
        map1[i] = 0

for w in map1:
    i = change_register(w)

    if (map1.get(w, None) is None) or (map2.get(i, None) is None):
        continue

    diff = map1[w] - map2.get(i, 0)

    if diff > 0:
        no += map1[w] - diff
        map2[i] = -(map1[w] - diff)
        map1[w] = -(map1[w] - diff)
    else:
        no += map1[w]
        map2[i] -= map1[w]
        map1[w] = 0

print(str(yes)+' '+str(no))

s = input()
t = input()
c = -ord('A') + ord('a')
ura = 0
opa = 0
s2 = set()
ind = set()
s1 = dict()
for i in range(len(s)):
    if ord(s[i]) not in s2:
        s2.add(ord(s[i]))
        s1[ord(s[i])] = 1
    else:
        s1[ord(s[i])] += 1

           

for i in range(len(t)):
        if ord(t[i]) in s2 and s1[ord(t[i])] >= 1:
            s1[ord(t[i])] -= 1
            ura += 1
            ind.add(i)
            
for i in range(len(t)):
    if i not in ind:
        if ord('z') >= ord(t[i]) >= ord('a'):
            if ord(t[i]) - c in s2 and s1[ord(t[i]) - c] >= 1:
                opa += 1
                s1[ord(t[i]) - c] -= 1
                ind.add(i)
        else:
            if ord(t[i]) + c in s2 and s1[ord(t[i]) + c] >= 1:
                opa += 1
                s1[ord(t[i]) + c] -= 1
                ind.add(i)  
print(ura, opa)
            


alth = "abcdefghijklmnopqrstuvwxyz"
alth2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
s2 = [[0]*26 for i in range(2)]
s3 = [[0]*26 for i in range(2)]
s = input()
t = input()
num = 0
num2 = 0
for i in s:
    temp = alth.find(i)
    if temp != -1:
        s2[0][temp] += 1
    temp = alth2.find(i)
    if temp != -1:
        s2[1][temp] += 1
for i in t:
    temp = alth.find(i)
    if temp != -1:
        s3[0][temp] += 1
    temp = alth2.find(i)
    if temp != -1:
        s3[1][temp] += 1        
for i in range(2):
    for j in range(26):
        x = min(s2[i][j],s3[i][j]) 
        num += x
        s2[i][j] -= x
        s3[i][j] -= x
for i in range(2):
    for j in range(26):
        num2 += min(s2[i][j],s3[1-i][j]) 
print(num,num2)


x = input()
y = input()

g1 = {}
g2 = {}
g3 = {}
g4 = {}

for i in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
    g2[i] = 0
    g4[i] = 0

for i in 'abcdefghijklmnopqrstuvwxyz':
    g1[i] = 0
    g3[i] = 0
    
e = 0
f = 0

u = []
l = []
u2 = []
l2 = []
for i in x:
    if i in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
        u.append(i)
        g2[i] += 1
    else:
        l.append(i)
        g1[i] += 1
        
for i in y:
    if i in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
        u2.append(i)
        g4[i] += 1
    else:
        l2.append(i)
        g3[i] += 1

for i in g1:
    ct = g1[i]
    can = g3[i]
    if ct != 0 and can != 0:
        if ct > can:
            g1[i] = ct - can
            g3[i] = 0
            e += can
        else:
            g3[i] = can - ct
            e += g1[i]
            g1[i] = 0
            

for i in g2:
    ct = g2[i]
    can = g4[i]
    if ct != 0 and can != 0:
        if ct > can:
            g2[i] = ct - can
            g4[i] = 0
            e += can
        else:
            g4[i] = can - ct
            e += g2[i]
            g2[i] = 0

for i in g1:
    ct = g1[i]
    can = g4[i.upper()]
    if ct != 0 and can != 0:
        if ct > can:
            g1[i] = ct - can
            g4[i.upper()] = 0
            f += can
        else:
            g4[i.upper()] = can - ct
            f += g1[i]
            g1[i] = 0
            

for i in g2:
    ct = g2[i]
    can = g3[i.lower()]
    if ct != 0 and can != 0:
        if ct > can:
            g2[i] = ct - can
            g3[i.lower()] = 0
            f += can
        else:
            g3[i.lower()] = can - ct
            f += g2[i]
            g2[i] = 0
            

print(e, f)


s=set()
sc=set()
t=set()
tc=set()
ms=[]
mt=[]
for letter in input():
    if letter==letter.lower():
        s.add(letter)
    else:
        sc.add(letter.lower())
    if letter not in ms:
        ms.append(letter)
        ms.append(1)
    else:
        ms[ms.index(letter)+1]+=1
for letter in input():
    if letter==letter.lower():
        t.add(letter)
    else:
        tc.add(letter.lower())
    if letter not in mt:
        mt.append(letter)
        mt.append(1)
    else:
        mt[mt.index(letter)+1]+=1
y=0
w=0
for letter in s.intersection(t):
    a=ms[ms.index(letter)+1]
    b=mt[mt.index(letter)+1]
    rs=set()
    rt=set()
    if a==b:
        y+=a
        ms[ms.index(letter)+1],mt[mt.index(letter)+1]=0,0
        rs.add(letter)
        rt.add(letter)
    elif a>b:
        y+=b
        ms[ms.index(letter)+1],mt[mt.index(letter)+1]=ms[ms.index(letter)+1]-mt[mt.index(letter)+1],0
        rt.add(letter)
    else:
        y+=a
        ms[ms.index(letter)+1],mt[mt.index(letter)+1]=0,mt[mt.index(letter)+1]-ms[ms.index(letter)+1]
        rs.add(letter)
    s,t=s-rs,t-rt
for letter in sc.intersection(tc):
    letter=letter.upper()
    a=ms[ms.index(letter)+1]
    b=mt[mt.index(letter)+1]
    rsc=set()
    rtc=set()
    if a==b:
        y+=a
        ms[ms.index(letter)+1],mt[mt.index(letter)+1]=0,0
        rsc.add(letter.lower())
        rtc.add(letter.lower())
    elif a>b:
        y+=b
        ms[ms.index(letter)+1],mt[mt.index(letter)+1]=ms[ms.index(letter)+1]-mt[mt.index(letter)+1],0
        rtc.add(letter.lower())
    else:
        y+=a
        ms[ms.index(letter)+1],mt[mt.index(letter)+1]=0,mt[mt.index(letter)+1]-ms[ms.index(letter)+1]
        rsc.add(letter.lower())
    sc,tc=sc-rsc,tc-rtc
for letter in sc.intersection(t):
    a=ms[ms.index(letter.upper())+1]
    b=mt[mt.index(letter)+1]
    rsc=set()
    rt=set()
    if a==b:
        w+=a
        rsc.add(letter)
        rt.add(letter)
    elif a>b:
        w+=b
        rt.add(letter)
    else:
        w+=a
        rsc.add(letter)
    sc,t=sc-rsc,t-rt
for letter in s.intersection(tc):
    a=ms[ms.index(letter)+1]
    b=mt[mt.index(letter.upper())+1]
    rs=set()
    rtc=set()
    if a==b:
        w+=a
        rs.add(letter)
        rtc.add(letter)
    elif a>b:
        w+=b
        rtc.add(letter)
    else:
        w+=a
        rs.add(letter)
    s,tc=s-rs,tc-rtc
print(y,w)

def process(str):
    d = {}
    for c in str:
        d[c] = d.setdefault(c, 0) + 1
    return d


def match(d1, d2, case):
    ans = 0
    for c in d1:
        if case(c) not in d2:
            continue
        m = min(d1[c], d2[case(c)])
        ans += m
        d1[c] -= m
        d2[case(c)] -= m
    return ans

sd = process(input())
td = process(input())
yay = match(sd, td, lambda x : x)
whoops = match(sd, td, lambda x : x.lower() if x.isupper() else x.upper())
print(yay, whoops)

A='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
a=A.swapcase()
Al=A+a
numS=[0 for i in Al]
numT=[0 for i in Al]
numT_=[0 for i in Al]
s=input()
t=input()
t_=t.swapcase()
yay=0
whoops=0
for i in range(len(Al)):
    numS[i]=s.count(Al[i])
    numT[i]=t.count(Al[i])
    numT_[i]+=t_.count(Al[i])
    
    yay+=min(numS[i],numT[i])
    
    if i<=25: k=i+26
    else: k=i-26
    numT_[k]-=min(numS[i],numT[i])
    numS[i]-=min(numS[i],numT[i])

for i in range(len(Al)):
    whoops+=min(numS[i],numT_[i])
print(yay,whoops)
    


def main():	
	s = (input())
	t = (input())

	arrS = [0] * 70
	arrT = [0] * 70
	count = 0
	count2 = 0
	n = len(s)
	for x in s:
		arrS[ord(x) - 65] += 1
	for x in t:
		arrT[ord(x) - 65] += 1
	for i in range(60):
		temp = min(arrS[i], arrT[i])
		arrS[i] -= temp
		arrT[i] -= temp
		count += temp
	for i in range(28):
		temp = min(arrS[i], arrT[i + 32])
		arrS[i] -= temp
		arrT[i + 32] -= temp
		count2 += temp
	for i in range(32, 68):
		temp = min(arrS[i], arrT[i - 32])
		arrS[i] -= temp
		arrT[i - 32] -= temp
		count2 += temp
	
	print(count, count2)



def __starting_point():
	main()
__starting_point()

def change(x) :
    if x == x.upper() :
        return x.lower()
    if x == x.lower() :
        return x.upper()

s,t = input(), input()
L = [0]*256
for i in t :
    L[ord(i)] += 1

ans1 = ans2 = 0
P = []
for i in s :
    x = ord(i)
    if L[x] > 0 :
        L[x] -= 1
        ans1 += 1
    else :
        P.append(i)

for i in P :
    x = ord(change(i))
    if L[x] > 0 :
        L[x] -= 1
        ans2 += 1
print(ans1, ans2)


def main():
    s, t = input(), input()
    mappingS = list(s)
    mappingT = list(t)
    yay = 0
    whoops = 0
    offset =  ord('A') - ord('a')
    for i in range(ord('a'), ord('z') + 1, 1):
        sLower = mappingS.count(chr(i))
        tLower = mappingT.count(chr(i))
        sUpper = mappingS.count(chr(i+offset))
        tUpper = mappingT.count(chr(i+offset))
        contribution = min(sLower,tLower) + min(sUpper, tUpper)
        yay += contribution
        whoops += min(tLower + tUpper, sLower + sUpper) - contribution
    print("{0} {1}".format(yay, whoops))

def __starting_point():
    main()
__starting_point()

msg = input()
l = input()
msg = list(msg)
d = {}
y = 0
w = 0
for i in l:
    if i not in d:
        d[i] = 0
    d[i] += 1

for j in range(len(msg)):
	i = msg[j]
	if i in d and d[i] > 0:
		d[i] -= 1
		y += 1
		msg[j] = chr(30)
for i in msg:

	if ord(i) >= 97:
		if chr(ord(i)-32) in d and d[chr(ord(i)-32)] > 0:
			w += 1
			d[chr(ord(i)-32)] -= 1
	else:
		if chr(ord(i)+32) in d and d[chr(ord(i)+32)] > 0 :
			d[chr(ord(i)+32)] -= 1
			w += 1
print(y,w)

s=input()
t=input()
scount=[]
tcount=[]
yay=0
whoop=0
for i in range(130):
    scount.append(0)
    tcount.append(0)
for i in range(len(s)):
    scount[ord(s[i])]+=1
for i in range(len(t)):
    tcount[ord(t[i])]+=1
for i in range(ord('a'),ord('z')+1):
    lowmin=min(scount[i],tcount[i])
    upmin=min(scount[ord(chr(i).upper())],tcount[ord(chr(i).upper())])
    yay+=lowmin+upmin
    scount[i]-=lowmin
    tcount[i]-=lowmin
    scount[ord(chr(i).upper())]-=upmin
    tcount[ord(chr(i).upper())]-=upmin
    whoop+=min(scount[i],tcount[ord(chr(i).upper())])+min(scount[ord(chr(i).upper())],tcount[i])
print(yay, whoop)    


def tanya_and_postcard(tanya_message, newspaper_letters):
    difference = ord('a') - ord('A')
    yays_count = 0
    whoopses_count = 0
    letters_counts = get_letters_counts(newspaper_letters)

    tanya_message = list(tanya_message)

    for index in range(0, len(tanya_message)):
        letter = tanya_message[index]

        if (letter in letters_counts) and (letters_counts[letter] > 0):
            letters_counts[letter] -= 1
            yays_count += 1
            tanya_message[index] = chr(0)

    for letter in tanya_message:
        letter = get_letter_in_opposite_casing(letter)

        if (letter in letters_counts) and (letters_counts[letter] > 0):
            letters_counts[letter] -= 1
            whoopses_count += 1

    return {'yays_count': yays_count, 'whoopses_count': whoopses_count}


def get_letters_counts(letters):
    letters_counts = {}

    for letter in letters:
        if letter in letters_counts:
            letters_counts[letter] += 1
        else:
            letters_counts[letter] = 1

    return letters_counts


def get_letter_in_opposite_casing(letter):
    if letter.islower():
        return letter.upper()
    else:
        return letter.lower()


def main():
    tanya_message = input()
    newspaper_letters = input()

    result = tanya_and_postcard(tanya_message, newspaper_letters)
    print('{0} {1}'.format(result['yays_count'], result['whoopses_count']))

def __starting_point():
    main()

__starting_point()

s = input().strip()
t = input().strip()
#print(s, t)
count_s = [0] * 100 #32 + 25
count_t = [0] * 100
ans1, ans2 = [0, 0]
for i in range(len(t)):
    count_t[ord(t[i]) - ord('A')] += 1
for i in range(len(s)):
    count_s[ord(s[i]) - ord('A')] += 1
for i in range(58):
    Min= min(count_s[i], count_t[i])
    count_s[i] -= Min
    count_t[i] -= Min
    ans1 += Min
#print(ans1, count_s, count_t)
for i in range(58):
    Min = min(count_s[i], count_t[(i + 32) % 64])
    count_s[i] -= Min
    count_t[(i + 32) % 64] -= Min
    ans2 += Min
print(ans1, ans2)
"""
print(count_s)
print(count_t)
"""

#!/usr/bin/env python3

from collections import Counter

s_set = Counter(input())
t_set = Counter(input())

yay_count = 0
whoops_count = 0

for s in s_set.keys():
	if s in t_set:
		num_to_remove = min(s_set[s], t_set[s])
		s_set[s] -= num_to_remove
		t_set[s] -= num_to_remove
		yay_count += num_to_remove

def flip_case(c):
	if c in 'abcdefghijklmnopqrstuvwxyz':
		return c.upper()
	else:
		return c.lower()

for s in s_set.keys():
	S = flip_case(s)
	if S in t_set:
		num_to_remove = min(s_set[s], t_set[S])
		s_set[s] -= num_to_remove
		t_set[S] -= num_to_remove
		whoops_count += num_to_remove

print(yay_count, whoops_count)

from collections import Counter
s = Counter(input())
t = Counter(input())
r1 = 0
for k in s:
    d = min(s[k], t[k])
    s[k] -= d
    t[k] -= d
    r1 += d
r2 = 0
for k in s:
    if k.islower():
        l = k.upper()
    else:
        l = k.lower()
    d = min(s[k], t[l])
    r2 += d
    s[k] -= d
    t[l] -= d
print(r1, r2)