单词统计
2013-12-22 15:57
127 查看
Time Limit: 1
Sec Memory
Limit: 64 MB
Submit:
125 Solved: 80
[Submit][Status][Web
Board]
#include
#include
using namespace std;
int main()
{char a[1000];
//char c,d;
gets(a);
int i,n=1;
for(i=0;;i++)
if(a[i+1]=='\0')
break;
else if(a[i]==' '&&a[i+1]!=' ')
n++;
cout<<n<<endl;
return 0;
}
Sec Memory
Limit: 64 MB
Submit:
125 Solved: 80
[Submit][Status][Web
Board]
Description
从键盘输入一行字符,统计其中单词的个数,各单词以空格分隔,且空格数可以是多个。Input
输入只有一行句子。仅有空格和英文字母构成。Output
单词的个数。Sample Input
stable marriage problem Consists of Matching members
Sample Output
7
#include
#include
using namespace std;
int main()
{char a[1000];
//char c,d;
gets(a);
int i,n=1;
for(i=0;;i++)
if(a[i+1]=='\0')
break;
else if(a[i]==' '&&a[i+1]!=' ')
n++;
cout<<n<<endl;
return 0;
}
相关文章推荐
- DP-统计单词个数
- 统计一个英文文本的单词出现的频率(有标点符号的)
- (11) Hadoop Java 实现MapReduce HelloWord 单词统计
- 蓝桥杯-统计单词数-map-java
- 统计单词个数
- 统计文章内各个单词出现的次数
- 题目1182:统计单词
- 05:统计单词数【NOIP2011复赛普及组第二题】
- Java+统计文件文章中单词的数量,去除指定特殊符号
- noip2001-统计单词个数2008.11.5
- N个任务掌握java系列之统计一篇文章中单词出现的次数
- 统计文件中单词个数--c++实现
- 【AC自动机】统计单词出现个数-数据增强修改
- word 统计特定单词出现个数
- HNUOJ 12609 统计单词 2013年“程序之星”ACM程序设计大赛(水题一A纪念)
- 统计单词个数
- 统计单词频率(shell版)
- 统计字符串中出现最多的单词和次多的单词
- 题目1182:统计单词
- 【一个句子里,单词的个数统计】