题解 | #游游的字母翻倍#
游游的字母翻倍
https://www.nowcoder.com/practice/e10ed38e315442fc9772004c58582c8f
// By SnowDream
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e6+10;
string s,tmp;
int n,q,l,r;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> q;
cin >> s;
while(q--)
{
cin >> l >> r;
tmp= "";
for(int i=l-1;i<r;i++)
{
string tmp1(2,s[i]);
tmp+=tmp1;
}
s.replace(l-1,r-l+1,tmp);
}
cout << s;
cout <<"\n";
return 0;
}