A9833 | Tanya and Postcard
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 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$ .
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.
- 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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted