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;
}
发表评论
- 浏览: 89157 次
- 性别:

- 来自: 长春

- 详细资料
搜索本博客
我的相册
cooliris
共 9 张
共 9 张
最近加入圈子
链接
最新评论
-
struts2 OGNL实例化数组的 ...
goodfifa07 写道请问楼主怎么捕获用数组发生的异常把logger级别调到 ...
-- by fuliang -
struts2 OGNL实例化数组的 ...
请问楼主怎么捕获用数组发生的异常
-- by goodfifa07 -
Java nio(三)
不错哦最近项目要用 可以向你请教此类的问题么 我的QQ1067302 希望能得到 ...
-- by bojianpc -
使用Struts2+Spring+Hiber ...
谢谢你的代码 我是一个初学者 ,没有什么资格说什么. 感谢.
-- by huobao89 -
学SSH2时写的入门例子
塔破铁鞋无觅处 谢谢了!
-- by songzhiyou






评论排行榜