Code forces string problem: Tanya and Postcard

https://codeforces.com/problemset/problem/518/B
Hi, my code gets the wrong answer on this question on the test case 8.

#include<bits/stdc++.h>
using namespace std;

int main()
{
    string a,b;cin >> a >> b;
    int y=0,f=0;
    int cnt1[26]={0},cnt2[26]={0};
    for(int i=0;i<b.size();++i){
        if(b[i]>='a' && b[i] <='z'){
            ++cnt1[b[i]-'a'];
        }
        else{
            ++cnt2[b[i]-'A'];
        }
    }
    for(int i=0;i<a.size();++i){
        if(a[i]>='a' && a[i]<='z'){
            if(cnt1[a[i]-'a']>0){
                ++y;--cnt1[a[i]-'a'];
            }
            else ++f;
        }
        else{
            if(cnt2[a[i]-'A']>0){
                ++y;--cnt2[a[i]-'A'];
            }
            else ++f;
        }
    }
    cout << y << " " << f;
}