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;
}
评论
发表评论

您还没有登录,请登录后发表评论

fuliang
搜索本博客
我的相册
53569b0e-134e-31fa-9555-bdfa6932b0e7-thumb
RSS Reader1
共 6 张
存档
最新评论