#include <bits/stdc++.h>
#define fr first
#define se second
using namespace std;
const long long N = 1e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;
int n;
int m;
int l;
int r;
char x;
string s;
int main()
{
/// freopen("input.txt", "r", stdin);
/// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio( false );
cin >> n >> m >> s;
for(int i = 1; i <= m; i ++){
cin >> x;
if(x == 'a'){
cin >> l >> r;
l --, r --;
string y = "";
y += s[l];
s.erase(l, 1);
s.insert(r, y);
}
else{
cin >> l;
cout << s[l - 1] << "\n";
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
11 ms |
376 KB |
Output is correct |
3 |
Correct |
21 ms |
632 KB |
Output is correct |
4 |
Correct |
177 ms |
2188 KB |
Output is correct |
5 |
Correct |
342 ms |
2196 KB |
Output is correct |
6 |
Correct |
483 ms |
2456 KB |
Output is correct |
7 |
Correct |
522 ms |
2580 KB |
Output is correct |
8 |
Correct |
217 ms |
2452 KB |
Output is correct |
9 |
Correct |
653 ms |
2712 KB |
Output is correct |
10 |
Correct |
450 ms |
2576 KB |
Output is correct |