A - "atcoder".substr()
Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 100 points
Problem Statement
Print the L-th through R-th characters of the string atcoder
.
Constraints
- L and R are integers.
- 1 ≤ L ≤ R ≤ 7
Input
Input is given from Standard Input in the following format:
L R
Output
Print the answer.
Sample Input 1
Copy
3 6
Sample Output 1
code
The 3-rd through 6-th characters of atcoder
are code
.
Sample Input 2
4 4
Sample Output 2
o
Sample Input 3
1 7
Sample Output 3
atcoder
代码(AC):
#include<bits/stdc++.h>
using namespace std;
int main() {
string s="atcoder";
int l,r;
cin>>l>>r;
cout<<s.substr(l-1,r-l+1);
return 0;
}