Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: hmmm

Problemset: Sofa Cat

Language: cpp

Time: 0.118 second

Submitted On: 2025-08-02 22:31:53

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

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

        for(auto e:p){
            for(int i=1;i<=huh;i++){
                cout << e << ' ';
           }
        }
    }
}