Clean Up Text

Lab Java Beginner 10 points

Read a line. Trim spaces from both ends, replace every _ with a space, and print the result and its length.

Input

One line.

Output

Two lines.

Example

Input

   hello_big_world   

Output

hello big world
15
Sample input available Sample output available
Editor
Java

Hints

trim() removes leading and trailing spaces.

Method calls can be chained.

Solution explanation

Each method returns a new String, so chaining applies them one after another.

Show solution
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String cleaned = sc.nextLine().trim().replace('_', ' ');
        System.out.println(cleaned);
        System.out.println(cleaned.length());
    }
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD