题目1182:统计单词

来源:互联网 发布:南京溧水网络问政 编辑:程序博客网 时间:2024/05/16 14:13

点击打开链接

/*时间:2014.2.1目的: 题目1182:统计单词ac.jobdu.com/problem.php?pid=1182*/ #include <stdio.h>int main(){char s[200];int i,cnt;while(gets(s)){cnt = 0;for(i=0;s[i];i++){if(s[i] == ' ' && cnt){printf("%d ",cnt);cnt = 0;}if(s[i] == '.')printf("%d\n",cnt);if((s[i]>64&&s[i]<91)||(s[i]>96&&s[i]<123))cnt++;}}}/*---------------------------hello how are you.思路;1.遍历一次数组,顺便输出 5 3 3 3--------------------------- */ 


0 0