AtCoder Beginner Contest 233 B - A Reverse
問題の要約
整数L,Rと、英小文字のみからなる文字列Sが与えられる。
SのL文字目からR文字目までの部分を反転した文字列を出力しろ。
制約
1<=|S|<=10^5
1<=L<=R<=|S|
入力
L R
S
考え方
1,C++の場合、文字列を逆順にするにはreverse関数を使うことができる。
実際のプログラム
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
long long L,R;
cin >> L >> R;
string S;
cin >> S;
reverse(S.begin()+L-1,S.begin()+R);
cout << S << endl;
return 0;
}