Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: un8qe_x3
Problemset: Sofa Cat
Language: cpp
Time: 0.097 second
Submitted On: 2025-11-17 21:42:04
#include <bits/stdc++.h>
using namespace std;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int q, sp = 1;
cin >> q;
while(q--){
string s;
cin >> s;
vector<char> v;
if(s == "oii"){
int c = 0;
char x;
while(1){
cin >> x;
v.push_back(x);
if(x == 'i'){
++c;
}else{
c = 0;
}
if(c == 3) break;
}
v.pop_back(); v.pop_back(); v.pop_back();
}else{
int c = 0;
char x;
while(1){
cin >> x;
if(x == 'i'){
++c;
}else if(x == 'a'){
++sp;
}else{
--sp;
sp = max(sp, 1);
}
if(c == 3) break;
}
}
for(auto x : v){
for(int i = 0;i<sp;i++){
cout << x << ' ';
}
}
}
}