102331: [AtCoder]ABC233 B - A Reverse

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $200$ points

Problem Statement

You are given integers $L$, $R$, and a string $S$ consisting of lowercase English letters.
Print this string after reversing (the order of) the $L$-th through $R$-th characters.

Constraints

  • $S$ consists of lowercase English letters.
  • $1 \le |S| \le 10^5$ ($|S|$ is the length of $S$.)
  • $L$ and $R$ are integers.
  • $1 \le L \le R \le |S|$

Input

Input is given from Standard Input in the following format:

$L$ $R$
$S$

Output

Print the specified string.


Sample Input 1

3 7
abcdefgh

Sample Output 1

abgfedch

After reversing the $3$-rd through $7$-th characters of abcdefgh, we have abgfedch.


Sample Input 2

1 7
reviver

Sample Output 2

reviver

The operation may result in the same string as the original.


Sample Input 3

4 13
merrychristmas

Sample Output 3

meramtsirhcyrs

Input

题意翻译

给定一个字符串 $s$ 和一个区间 $[l,r]$,将 $s_l$ 至 $s_r$ 的字符倒转后输出。 倒装:将 $s_l$ 改变为 $s_r$,$s_{l+1}$ 改变为 $s_{r-1}$,$\cdots$,$s_r$ 改变为 $s_l$。 Translated by ShanCreeper.

Output

分数:200分

问题描述

给定整数$L$,$R$和一个仅包含小写英文字母的字符串$S$。

反转字符串$S$中第$L$个至第$R$个字符的顺序。

限制条件

  • $S$仅包含小写英文字母。
  • $1 \le |S| \le 10^5$ ($|S|$表示$S$的长度)。
  • $L$和$R$为整数。
  • $1 \le L \le R \le |S|$。

输入

输入数据通过标准输入给出,格式如下:

$L$ $R$
$S$

输出

输出指定的字符串。


样例输入1

3 7
abcdefgh

样例输出1

abgfedch

将字符串`abcdefgh`中第3个至第7个字符反转后得到字符串`abgfedch`。


样例输入2

1 7
reviver

样例输出2

reviver

反转操作可能使字符串保持不变。


样例输入3

4 13
merrychristmas

样例输出3

meramtsirhcyrs

加入题单

算法标签: