Read a Full Line

Lab Java Beginner 10 points

Read a whole line (it may contain spaces) and print Hello, LINE!

Input

One line.

Output

The greeting.

Example

Input

Ada Lovelace

Output

Hello, Ada Lovelace!
Sample input available Sample output available
Editor
Java

Hints

next() reads one word; nextLine() reads the whole line.

Solution explanation

Use nextLine() when the input can contain spaces.

Show solution
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String name = sc.nextLine();
        System.out.println("Hello, " + name + "!");
    }
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD