Java Substring Hackerrank Solution
For Explanation Watch Video:
Sample Input
Helloworld
3 7
Sample Output
lowo
Code:
import java.io.*;import java.util.*;import java.text.*;import java.math.*;import java.util.regex.*;
public class Solution {
public static void main(String[] args) { Scanner in = new Scanner(System.in); String S = in.next(); int start = in.nextInt(); int end = in.nextInt(); System.out.println(S.substring(start,end)); }}
Comments
Post a Comment