当前位置:网站首页>Acwing3593. 统计单词
Acwing3593. 统计单词
2022-08-04 22:28:00 【理工大猪猪】
编写一个程序,读入用户输入的,以 . 结尾的一行文字,统计一共有多少个单词,并分别输出每个单词含有多少个字符。 (凡是以一个或多个空格隔开的部分就为一个单词)
输入格式
共一行,包含一个以 . 结尾的字符串。
输出格式
共一行,按顺序输出字符串中每个单词包含的字母的个数。
数据范围
字符串长度不超过 1000。
输入样例:
hello how are you.
输出样例:
5 3 3 3#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
string st;
while(cin >> st){
if(st[st.size() - 1] != '.') cout << st.size() << ' ';
else cout << st.size() - 1 << ' ';
}
return 0;
}
边栏推荐
- 【3D建模制作技巧分享】ZBrush纹理贴图怎么导入
- [Linear Algebra 02] 2 interpretations of AX=b and 5 perspectives of matrix multiplication
- 移动web开发03
- # #ifndef/#define/#endif使用详解
- 得不到你的心,就用“分布式锁”锁住你的人
- 【TCP/IP 五 ICMP】
- 2022强网杯web(部分)
- Both synchronized and ReentrantLock are smooth, because they are reentrant locks, and a thread will not deadlock if it takes the lock multiple times. We need reentrant locks
- 剑指 Offer | 03. 数组中重复的数字
- Redis理解
猜你喜欢
随机推荐
JVM内存配置参数GC日志
【模拟面试-10年工作】项目多一定是优势吗?
赶紧进来!!!教你C语言实现扫雷小游戏(文章最后有源码!!!)
rk3399-9.0 first-level and second-level dormancy
ANT1.7下载以及配置方法
DREAMWEAVER8 部分问题解决方案
老叶的三束玫瑰
软测人面试 ,HR 会问到哪些问题?学会涨薪3000+
软件测试外包公司怎么样?有什么好处和坏处?为什么没人去?
年薪40W测试工程师成长之路,你在哪个阶段?
Redis understanding
rk3399-0.0 svc命令
Redis中的LRU算法
torch单机多卡和多机多卡训练
rk3399-0.0 svc command
# #ifndef/#define/#endif使用详解
3D激光SLAM:LeGO-LOAM---两步优化的帧间里程计及代码分析
numpy关于两个array叠加操作
idea 仓库地址连接不上问题
【组成原理 六 存储器类型】









