用java编写一段代码获取下面文章中的单词(长度在5-15之间,并且c在o前面)并将其显示出来拜托各位大神

TheLibraryofCongresswasin1800.ItstartedwithelevenboxesofbooksinoneroomoftheCapitolBui... The Library of Congress was in 1800. It started with eleven boxes of books in one room of the Capitol Building. By 1814, the collection had increased to about 3,000 books. They were all that year when the Capitol was burned down during America’s war with Britain. 展开
 我来答
艺吧顶贴组小匽
2014-08-08 · 超过45用户采纳过TA的回答
知道答主
回答量:90
采纳率:0%
帮助的人:108万
展开全部
将那段文章放在文件内,然后用IO流读出来 或者直接String s = 上面那段 然后 StringTokenizer st = new StringTokenizer(s," "); String temp; while(st.hasNext()){ temp = st.next(); if(temp.length()>=5 && temp.length()<=15){ for(int i = 0; i < temp.length()-1; i++){ if(temp.toChar(i) == 'c') if(temp.toChar(i+1) == 'o') System.out.println(temp); } } 大体思路是这样. }
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式