Submission
Status:
----------
Subtask/Task Score:
0/100
Score: 0
User: foldnut
Problemset: Sofa Cat
Language: cpp
Time: 0.194 second
Submitted On: 2025-11-17 20:06:20
#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;
v.push_back(x);
if(x == 'i'){
++c;
}else if(x == 'a'){
++sp;
}else{
--sp;
if(!sp) sp = 1;
}
if(c == 3) break;
}
}
for(auto x : v){
for(int i = 0;i<sp;i++){
cout << x << ' ';
}
}
}
}