AcWing 3640. 删除字符串
原题链接
简单
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int N = 1e6 + 10;
int t, n, m, k, l, r, op, x, y, p;
int f[N];
bool flag;
const string zc = "gzu";
void solve() {
string str;
cin >> str;
while ((p = str.find(zc)) != -1) {
str.replace(p, zc.size(), "\n");
}
while ((p = str.find("\n")) != -1) {
str.replace(p, 1, "");
}
cout << str;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}