解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int max=0;
String str=scanner.nextLine();
String str1 = "";
int m=0;
while(m!=-1) {
m=str.indexOf(" ");
if(m>max) {
max=m;
str1=str.substring(0,str.indexOf(" "));
}
str=str.substring(str.indexOf(" ")+1,str.length());
//if(m==-1)
//break;
}
if(str.length()>max)
System.out.println(str);
else
System.out.println(str1);
}
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题1.5 (C++代码)浏览:756 |
最长单词 (C语言代码)浏览:1363 |
众数问题 (C语言代码)浏览:822 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:561 |
1012题解浏览:862 |
永远的丰碑 (C语言代码)浏览:516 |
矩阵的对角线之和 (C语言代码)浏览:1344 |
简单的a+b (C语言代码)浏览:460 |
A+B for Input-Output Practice (I) (C语言代码)浏览:427 |
母牛的故事 (C语言代码)浏览:451 |