import string
from collections import defaultdict
a = input()
b = input()
n = int(input())
mps = []
mp1 = defaultdict(int)
mp2 = defaultdict(int)
for ch in string.ascii_letters:
    mp1[ch] = a.count(ch)
    mp2[ch] = b.count(ch)
mps.append(mp1)
mps.append(mp2)
for i in range(2, n):
    nmp = {}
    for ch in string.ascii_letters:
        nmp[ch] = mps[-1][ch] + mps[-2][ch]
    mps.append(nmp)
if n == 1:
    amp = mp1
elif n == 2:
    amp = mp2
else:
    amp = mps[-1]
for ch in string.ascii_uppercase + string.ascii_lowercase:
    if amp[ch] > 0:
        print(ch + ": " + str(amp[ch]))