A:面试
简单的模拟,把题目意思翻译一下就是A大于等于3的时候输出sp offer,有2个C或者出现D则failed,否则输出offer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2555555;
inline ll read(){
    ll s=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;c=getchar();
    }
    while(c>='0'&&c<='9'){
        s=(s<<1)+(s<<3)+(c^48);c=getchar();
    }
    return f*s;
}
int main(){
    int n=read();
    for(int i=1;i<=n;i++){
        string s;
        cin>>s;
        int a=0,b=0,c=0,d=0;
        for(int j=0;j<4;j++){
            if(s[j]=='A')a++;
            else if(s[j]=='B')b++;
            else if(s[j]=='C')c++;
            else d++;
        }
        if(a>=3&&d==0){
            cout<<"sp offer"<<endl;
        }
        else if(c>=2||d>=1){
            cout<<"failed"<<endl;
        }
        else{
            cout<<"offer"<<endl;
        }
    }
    return 0;
}