L1-5 宇宙无敌大招呼 (5分)

据说所有程序员学习的第一个程序都是在屏幕上输出一句“Hello World”,跟这个世界打个招呼。作为天梯赛中的程序员,你写的程序得高级一点,要能跟任意指定的星球打招呼。

输入格式:

输入在第一行给出一个星球的名字S,是一个由不超过7个英文字母组成的单词,以回车结束。

输出格式:

在一行中输出Hello S,跟输入的S星球打个招呼。

输入样例:

Mars

    
    

输出样例:

Hello Mars

    
    
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

//** Class for buffered reading int and double values *//*
class Reader {
	static BufferedReader reader;
	static StringTokenizer tokenizer;

	// ** call this method to initialize reader for InputStream *//*
	static void init(InputStream input) {
		reader = new BufferedReader(new InputStreamReader(input));
		tokenizer = new StringTokenizer("");
	}

	// ** get next word *//*
	static String next() throws IOException {
		while (!tokenizer.hasMoreTokens()) {
			// TODO add check for eof if necessary
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}
	static boolean hasNext()throws IOException {
		return tokenizer.hasMoreTokens();
	}
	static String nextLine() throws IOException{
		return reader.readLine();
	}
	static char nextChar() throws IOException{
		return next().charAt(0);
	}
	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static float nextFloat() throws IOException {
		return Float.parseFloat(next());
	}
}
public class Main {

	public static void main(String[] args) throws IOException {
		Reader.init(System.in);
		String s = Reader.nextLine();
		System.out.println("Hello "+s);
	}
}



发布了45 篇原创文章 · 获赞 8 · 访问量 1769

猜你喜欢

转载自blog.csdn.net/weixin_43888039/article/details/104108398
今日推荐