2007-04-09
JOJ ACM 2155
Mr. Jojer has written an article, but now he wants to make a copy of it and check out how many characters he has used.
Input and Output
You will be given an article, you should output this article again and how many characters are there.
Sample Input
FerrAriS and Jojer are friends.
Sample Output
FerrAriS and Jojer are friends.
32
Note: All the characters must be counted, even they can’t be displayed. And do not output extra characters.
code:
#include<stdio.h>
int main()
{
char ch;
int num=0;
while(ch=getchar(),ch!=EOF)
{
printf("%c",ch);
num++;
}
printf("%d",num);
return 0;
}
Input and Output
You will be given an article, you should output this article again and how many characters are there.
Sample Input
FerrAriS and Jojer are friends.
Sample Output
FerrAriS and Jojer are friends.
32
Note: All the characters must be counted, even they can’t be displayed. And do not output extra characters.
code:
#include<stdio.h>
int main()
{
char ch;
int num=0;
while(ch=getchar(),ch!=EOF)
{
printf("%c",ch);
num++;
}
printf("%d",num);
return 0;
}
发表评论
- 浏览: 52484 次
- 性别:

- 来自: 长春

- 详细资料
搜索本博客
我的相册
RSS Reader1
共 6 张
共 6 张
链接
最新评论
-
写了一个支持搜索并下载歌 ...
引用 为什么要配置成legal_music_link=http://202.10 ...
-- by fuliang -
使用Struts2+Hibernate+Sp ...
很好很强大
-- by andy54321 -
Java Persistence with Hi ...
昨天买的, 不错
-- by lklkdawei -
使用Struts2+Spring+Hiber ...
不过整个工程都没有一条注释啊。。。 这个比较郁闷,万一以后你写了个框架,那下面 ...
-- by yyphzc -
使用Struts2+Spring+Hiber ...
总体感觉还行,不过部分代码需要优化为好 1.DAO既然使用泛型,那就干脆点。想想 ...
-- by yeshucheng






评论排行榜