题3
来源:互联网 发布:淘宝手机架 编辑:程序博客网 时间:2024/05/17 05:08
统计一行字符中有多少个单词
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()){ String str=sc.nextLine(); int word=0; int count=0; for (int i = 0; i <str.length() ; i++) { if(str.charAt(i)==' '){ word=0; }else if(word==0){ word=1; count++; } } System.out.println(count); } }}
阅读全文
0 0
- 题3
- 题3
- 上机题3
- 微软笔试题3
- 面试算法题3
- 经典SQL题3
- 逻辑思维题 3
- 面试模拟题3
- 笔试题3
- 笔试题收集-3
- 1.1.3检测题
- tx笔试题3
- .NET笔试题3
- 百度笔试题3
- 中兴笔试题-3
- pythonchallenge 【第3题】
- 笔试题3
- Astar 第3题
- table加到JScrollPane不能变大小 问题
- Chrome58以上版本Goagent访问google显示不安全使用问题解决
- vim常用快捷键总结
- PAT甲级 1132. Cut Integer (20)
- matplotlib绘制条形图
- 题3
- spring camel 最简单的入门例子
- Linux文件操作命令----有关文件显示的命令
- vue报错 listen EADDRINUSE :::8080
- 实验一线性表的基本操作实现及其应用
- AndroidStudio+Git+SourceTree实现在Git-os和GitHub远程操作
- jvm参考
- Mac 常用快捷键
- jquery ajax 传递数组 到后台收不到