input.next(); 是以空格为分隔符进行读取的;
input.nextLine() 是以回撤为分隔符进行读取的;
JAVA在进行按行读取的时候就要用到nextLine()函数。
但是要注意:
例如
2
aeiou
my name is ignatius
这样的输入,用nextInt()读完2之后,还有一个回车键是next不读取的留给下面,
所以在读取aeiou的时候要先用一个nextLine()把上面的空格吸收。具体实现就是
int count = input.nextInt();
input.nextLine();
for(int i=0;i<=count-1;i++){
...
}