#55681: c++解法


61247091s@gapps.ntnu.edu.tw (wei)


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    string s;
    cin>>t;
    getline(cin,s);
    while(t--){
        string s,tmp;
        getline(cin,s);
        stringstream ss(s);
        int eat=0,to=0;
        bool douto=false;
        while(ss>>tmp){
            if(tmp=="chi")eat++;
            else if(tmp=="tu")to++;
            if(to>eat)douto=true;
        }
        if(eat>to&&!douto){cout<<"chi pu tao bu tu pu tao pi"<<endl;continue;}
        if(eat>to&&douto){cout<<"chi pu tao bu tu pu tao pi, bu chi pu tao dao tu pu tao pi"<<endl;continue;}
        if(douto){cout<<"bu chi pu tao dao tu pu tao pi"<<endl;continue;}
        cout<< "chi pu tao tu pu tao pi"<<"\n";
    }
    return 0;
}