str1 = str(input())
str2 = str(input())
list1 = []
list2 = []
count = 0
for letter in str1:
list1.append(letter)
for letter in str2:
list2.append(letter)
while len(list1) > 0 and len(list2) > 0:
if list1[0] == list2[0]:
list1.pop(0)
list2.pop(0)
count +=1
else:
list1.pop(0)
list2.pop(0)
if count == 1:
print(f'{count} character matches')
else:
print(f'{count} characters match')
while len(list1) > 0 and len(list2) > 0:
if list1[0] == list2[0]:
list1.pop(0)
list2.pop(0)
count +=1
else:
list1.pop(0)
list2.pop(0)
if count == 1:
print(f'{count} character matches')
else:
print(f'{count} characters match')