We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Java
  3. Strings
  4. Java Substring

Java Substring

Problem
Submissions
Leaderboard
Discussions
Editorial

Given a string, , and two indices, and , print a substring consisting of all characters in the inclusive range from to . You'll find the String class' substring method helpful in completing this challenge.

Input Format

The first line contains a single string denoting .
The second line contains two space-separated integers denoting the respective values of and .

Constraints

  • String consists of English alphabetic letters (i.e., ) only.

Output Format

Print the substring in the inclusive range from to .

Sample Input

Helloworld
3 7

Sample Output

lowo

Explanation

In the diagram below, the substring is highlighted in green:

substring.png

Author

Shafaet

Difficulty

Easy

Max Score

5

Submitted By

305246

Need Help?


View discussions
View editorial
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature