CF518B.Tanya and Postcard
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
小塔尼娅决定在爸爸生日时送他一张明信片。她已经写好了一条消息——一个长度为 n 的字符串 s,由大小写英文字母组成。塔尼娅还不会写字,于是她找来一份报纸,打算从中剪下字母并粘贴到明信片上,以拼出字符串 s。这份报纸包含一个字符串 t,同样由大小写英文字母组成。已知字符串 t 的长度不小于字符串 s 的长度。
报纸中某些字母的出现次数可能不足以拼出所需消息,而另一些字母又可能过多。因此,塔尼娅打算从报纸中恰好剪下 n 个字母,拼成一个长度恰好为 n 的字符串,使其尽可能接近 s。若拼出的字符串在某个位置上的字母与 s 中对应位置的字母完全相同(包括大小写),则她会高兴地大喊一声“YAY!”;若该位置上的字母与 s 中对应位置的字母字母相同但大小写不同,则她会说一声“WHOOPS”。
塔尼娅希望所拼出的消息能使“YAY!”的次数尽可能多。若存在多种方案使得“YAY!”次数达到最大,则她的第二目标是使“WHOOPS”的次数也尽可能多。你的任务就是帮助塔尼娅完成这张明信片。
输入格式
The first line contains line s (1 ≤ |s| ≤ 2·105), consisting of uppercase and lowercase English letters — the text of Tanya's message.
The second line contains line t (|s| ≤ |t| ≤ 2·105), consisting of uppercase and lowercase English letters — the text written in the newspaper.
Here |a| means the length of the string a.
第一行包含字符串 s(1 ≤ ∣s∣ ≤ 2⋅105),由大小写英文字母组成——即塔尼娅消息的文本。
第二行包含字符串 t(∣s∣ ≤ ∣t∣ ≤ 2⋅105),由大小写英文字母组成——即报纸上所写的文本。
其中 ∣a∣ 表示字符串 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.
输出两个由空格分隔的整数:
- 第一个数字是塔尼娅在编写该消息过程中喊出“YAY!”的次数;
- 第二个数字是塔尼娅在编写该消息过程中说出“WHOOPS”的次数。
输入输出样例
输入#1
AbC DCbA
输出#1
3 0
输入#2
ABC abc
输出#2
0 3
输入#3
abacaba AbaCaBA
输出#3
3 4
输入解题思路,AI测评打分。不知道怎么写?