-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaSubstring.java
More file actions
40 lines (29 loc) · 990 Bytes
/
Copy pathJavaSubstring.java
File metadata and controls
40 lines (29 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
problem statement :Java Substring
Given a string, s, and two indices, start and end, print a substring consisting of all characters in the inclusive range from start to end-1. You'll find the String class' substring method helpful in completing this challenge.
Input Format
The first line contains a single string denoting s.
The second line contains two space-separated integers denoting the respective values of start and end.
Constraints
1 <= |s| <= 100
0 <= start < end <= n
String s consists of English alphabetic letters (i.e.a-z,A-Z ) only.
Output Format
Print the substring in the inclusive range from start to end-1.
Sample Input
Helloworld
3 7
Sample Output
lowo
*/
import java.io.*;
import java.util.*;
public class Solution12 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s= sc.nextLine();
int a= sc.nextInt();
int b= sc.nextInt();
System.out.println(s.substring(a,b));
}
}