302667: CF518B. Tanya and Postcard

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Tanya and Postcard

题意翻译

有个小女孩决定给他的爸爸寄明信片。她已经想好了一句话(即长度为n的字符串s),包括大写和小写英文字母。但是他不会写字,所以她决定将报纸里的字母剪下来贴到明信片上,最好能够把字符串s拼凑出来。报纸里包含字符串t,包括大写和小写英文字母。我们知道,t的长度大于或等于串s的长度。 如果在s串中的某些位置上的字母能够在报纸串t中找到对应一模一样的字符,那么,她会高兴地喊“耶!”,如果在s串中的某些位置的字母只能在报纸串t中找到对应的字母(但是大小写对应不上),那么这个女孩说:“哎呦”。 现在,小女孩希望她喊“耶!”越多越好。在“耶!”一样多的情况下,她说:“哎呦”要尽量多。请你帮助来计算这两个的数量。 注意每个字母只能用一次。 第一行包含串$s(1\leq |s|\leq2\times10^5)$ ,由大写和小写英文字母组成 第二行包含串$t(|s|\leq |t|\leq2\times10^5)$ ,包括大写和小写英文字母, 即写在报纸上的文字。 这里$|a|$ 表示字符串的长度。 输出两个用空格隔开的非负整数: 第一个数字是小姑娘说“耶!”的次数。 第二个数字是小姑娘说“哎呦”的次数。 Translated by @馒头精

题目描述

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.

输入输出格式

输入格式


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 $ .

输出格式


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.

输入输出样例

输入样例 #1

AbC
DCbA

输出样例 #1

3 0

输入样例 #2

ABC
abc

输出样例 #2

0 3

输入样例 #3

abacaba
AbaCaBA

输出样例 #3

3 4

Input

题意翻译

有个小女孩决定给他的爸爸寄明信片。她已经想好了一句话(即长度为n的字符串s),包括大写和小写英文字母。但是他不会写字,所以她决定将报纸里的字母剪下来贴到明信片上,最好能够把字符串s拼凑出来。报纸里包含字符串t,包括大写和小写英文字母。我们知道,t的长度大于或等于串s的长度。 如果在s串中的某些位置上的字母能够在报纸串t中找到对应一模一样的字符,那么,她会高兴地喊“耶!”,如果在s串中的某些位置的字母只能在报纸串t中找到对应的字母(但是大小写对应不上),那么这个女孩说:“哎呦”。 现在,小女孩希望她喊“耶!”越多越好。在“耶!”一样多的情况下,她说:“哎呦”要尽量多。请你帮助来计算这两个的数量。 注意每个字母只能用一次。 第一行包含串$s(1\leq |s|\leq2\times10^5)$ ,由大写和小写英文字母组成 第二行包含串$t(|s|\leq |t|\leq2\times10^5)$ ,包括大写和小写英文字母, 即写在报纸上的文字。 这里$|a|$ 表示字符串的长度。 输出两个用空格隔开的非负整数: 第一个数字是小姑娘说“耶!”的次数。 第二个数字是小姑娘说“哎呦”的次数。 Translated by @馒头精

加入题单

算法标签: