013-001-005

String Class: Substring

Easy

Problem Description

String class: Substring

In this problem, you will create a program that extracts a substring from a specified range using the substring(start, end) method and displays both the original string and the extracted substring to standard output.

Learning Objective: Extract string with substring method

Create program extracting substring from specified range. Use substring(start, end) to extract from start position to (end-1) position.

Input

Line 1: String
Line 2: Start position (integer)
Line 3: End position (integer)

Output

Original: [original string]
Substring: [substring]
```java

## Examples

### Example 1: Extract from beginning
Input:
```java
Hello
0
3
```java
Output:
```java
Original: Hello
Substring: Hel
```java

### Example 2: Extract from middle
Input:
```java
Java
1
4
```java
Output:
```java
Original: Java
Substring: ava
```java

### Example 3: Boundary (1 character)
Input:
```java
A
0
1
```java
Output:
```java
Original: A
Substring: A

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up