|
面试失败,叫编一个程序,但在给定时间没编出来,那题目出来分享下,希望高手可以做出来
题目:
编写一程序输出一个由若干单词构成的字符串中的最长单词及其长度,若字符串中有多个单词满足条件须将这些单词全部输出。(注:程序书写要规范)
例:输入字符串为“The indictment said the defendants had collected geographical data indicating thousands of people would be killed in the chemical blast”
输出应为:
最长单词:geographical
单词长度:12
在CSDN的java版转来的...大家看看... |
|