Submission

Status:

P---------

Subtask/Task Score:

10/100

Score: 10

User: hmmm

Problemset: Sofa Cat

Language: cpp

Time: 0.003 second

Submitted On: 2025-08-02 22:06:35

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

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int n,chk=0;
    cin >> n;
    vector<char> p;
    while(n--){
        int huh=0;
        string s;
        cin >> s;
        p.clear();
        if(s=="oii"){
            int cnt=0;
            char a;
            while(cin >> a){
                if(a=='i') cnt++;
                else cnt=0;
                if(cnt==3) break;
                p.push_back(a);
            }
            p.pop_back();
            p.pop_back();
            huh=1;
        }
        else{
            huh=1;
            chk++;
            int cnt=0;
            char a;
            while(cin >> a){
                if(a=='i') cnt++;
                else if(a=='a') huh++;
                else huh--;
                // p.push_back(a);
                if(cnt==3) break;
            }
        }
        // for(auto e:p) cout << e << ' ';
        // cout << "\n";
        if(chk%2==0){
            for(auto e:p) cout << e << ' ';
        }
        else{
            for(auto e:p){
                for(int i=1;i<=huh;i++){
                    cout << e << ' ';
                }
            }
        }
    }
}