518B.md (2258B)
1 Source: https://codeforces.com/problemset/problem/518/B 2 3 B. Tanya and Postcard 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 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*. 22 23 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". 24 25 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. 26 27 Input 28 29 The first line contains line *s* (1 ≤ |*s*| ≤ 2·105), consisting of uppercase and lowercase English letters — the text of Tanya's message. 30 31 The second line contains line *t* (|*s*| ≤ |*t*| ≤ 2·105), consisting of uppercase and lowercase English letters — the text written in the newspaper. 32 33 Here |*a*| means the length of the string *a*. 34 35 Output 36 37 Print two integers separated by a space: 38 39 * the first number is the number of times Tanya shouts "YAY!" while making the message, 40 * the second number is the number of times Tanya says "WHOOPS" while making the message. 41 42 Examples 43 44 Input 45 46 ``` 47 AbC 48 DCbA 49 ``` 50 51 Output 52 53 ``` 54 3 0 55 ``` 56 57 Input 58 59 ``` 60 ABC 61 abc 62 ``` 63 64 Output 65 66 ``` 67 0 3 68 ``` 69 70 Input 71 72 ``` 73 abacaba 74 AbaCaBA 75 ``` 76 77 Output 78 79 ``` 80 3 4 81 ```