-
Notifications
You must be signed in to change notification settings - Fork 0
/
293_B. Tanya and Postcard.cpp
71 lines (63 loc) · 1.54 KB
/
293_B. Tanya and Postcard.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ss string
#define nn "\n"
#define nl "\n"
#define yes cout<<"YES"<<nn
#define no cout<<"NO"<<nn
#define MOD 1000000007
#define pll pair<ll,ll>
#define For(i,x,n) for(ll i=x;i<n;i++)
#define IN1(x); ll x;cin>>x;
#define IN2(x,y); ll x,y;cin>>x>>y;
#define IN3(x,y,z); ll x,y,z;cin>>x>>y>>z;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
void solve()
{
string s, t;
cin >> s >> t;
map<char,ll> mp;
for (auto c : t)
mp[c]++;
int y = 0, w = 0;
for (int i = 0;i < s.length();i++){
if (mp.count(s[i]) && mp[s[i]] > 0){
y++;
mp[s[i]]--;
s[i] = '0';
}
}
for (int i = 0;i < s.length();i++){
if (s[i] != '0'){
if (s[i] >= 97 && mp[s[i] - 32] > 0){
w++;
mp[s[i] - 32]--;
}
if (s[i] <= 90 && mp[s[i] + 32] > 0){
w++;
mp[s[i] + 32]--;
}
}
}
cout << y << ' ' << w<<nl;
}
int main ()
{
fastio;
#ifndef ONLINE_JUDGE
freopen ( "input.txt", "r", stdin );
//freopen ( "output.txt", "w", stdout );
#endif
ll t = 1;
//cin >> t;
while(t--)
{
solve();
}
printclock
cout.flush();
return 0;
}