当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
随机推荐
Hardware factors such as CPU, memory, and graphics card also affect the performance of your deep learning model
rk3399-9.0一级二级休眠
Deep Learning RNN Architecture Analysis
今天又做了三个梦,其中一个梦梦里的我还有意识会思考?
If you can't get your heart, use "distributed lock" to lock your people
剑指Offer | 数值的整数次方
今天是七夕,来看看程序员的土味情话。
the warmest home
智慧养老整体解决方案
Redis中的LRU算法
SQL Server calls WebService
直播带货为农产品开拓销售渠道
视频gif如何制作?试试这个视频制作gif神器
Several ways for rk3399 to drive screen parameters
shell选择结构(if)
历史上的今天:PHP公开发布;iPhone 4 问世;万维网之父诞生
[Linear Algebra 02] 2 interpretations of AX=b and 5 perspectives of matrix multiplication
VSCode—常用快捷键(持续记录
现在学习次世代3D游戏建模还能找到高薪好工作吗
Ts——项目实战应用enum枚举








