1. string的函数
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,m; cin >> n;
string s, a, b, c;
cin >> s;
for (int i = 0; i < n; i++) {
cin >> m;
if (m == 1) {
cin >> a;
s += a;
cout << s << endl;
}
if (m == 2) {
int x, y;
cin >> x>> y;
s = s.substr(x, y);
cout << s << endl;
}
if (m == 3) {
int x;
cin >> x >> b;
s = s.insert(x, b);
cout << s << endl;
}
if (m == 4) {
cin >> c;
if (s.find(c,0) < s.size())
cout << s.find(c,0) << endl;
else cout << -1<<endl;
}
}
return 0;
}