Inversion of a String
InterviewTime limit2sMemory limit512 MB
Reverse the substring of S from position A to position B, keep the rest unchanged, and print the resulting string.
- Level
Easy1 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
You are given a string S of length N.
If you reverse the order of the characters from the A-th character to the B-th character of S and leave the other characters unchanged, what string do you get? The first character of S is the 1st character, and the last character is the N-th character.
Given a string S and two integers A, B, write a program that prints the string obtained by reversing the order of the characters from the A-th character to the B-th character of S.
Input
The input is given from standard input in the following format.
N A B
S
Output
Print on one line the string obtained by reversing the order of the characters from the A-th character to the B-th character of S.
Constraints
1 ≦ A ≦ B ≦ N ≦ 200.Sis a string of lengthN.- Each character of
Sis an uppercase or lowercase English letter.