Failing to identify the failing test - case (Transfusion chain STATER 95)

Describe your issue

In problem Transfusion Chain STATER 95 is failing for test case ( O AB AB B) according to question its
answer should be 3 (1->2->3) but it is accepting the answer 4 .

Screenshot

image

**type or paste code here**
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define fix(x) fixed << setprecision(x)
#define asc(x) x, vector<x>, greater<x>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}
constexpr ll INFLL = (1LL << 62), MOD = 998244353;
constexpr int INF = (1 << 30);

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    string s[] = {"A", "B", "AB", "O"};
    while(t--){
        int n;
        cin >> n;
        vector<int> cnt(4,0);
        rep(i,n){
            string x;
            cin >> x;
            rep(j,4) cnt[j] += (x==s[j]);
        }
        cout << max(cnt[0],cnt[1])+cnt[2]+cnt[3] << '\n';
    }
    return 0;
}

answer should be 4.
chain will be O → B → AB → AB
elements of chain need not to be consecutive in given array as they are in chain.

Ok got it