Substrings

Lab Java Beginner 10 points

Read a word of at least 4 letters. Print the first 3 letters, the last 3 letters and the word without its first and last letter.

Input

One word.

Output

Three lines.

Example

Input

keyboard

Output

key
ard
eyboar
Sample input available Sample output available
Editor
Java

Hints

substring(start, end) includes start but excludes end.

substring(start) goes to the end.

Solution explanation

The end index is exclusive, so substring(0, 3) returns 3 characters.

Show solution
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String w = sc.next();
        System.out.println(w.substring(0, 3));
        System.out.println(w.substring(w.length() - 3));
        System.out.println(w.substring(1, w.length() - 1));
    }
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD