AC Me

Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 63   Accepted Submission(s) : 19
Problem Description
Ignatius is doing his homework now. The teacher gives him some articles and asks him to tell how many times each letter appears. It's really easy, isn't it? So come on and AC ME.
 
Input
Each article consists of just one line, and all the letters are in lowercase. You just have to count the number of each letter, so do not pay attention to other characters. The length of article is at most 100000. Process to the end of file. Note: the problem has multi-cases, and you may use "while(gets(buf)){...}" to process to the end of file.
 
Output
For each article, you have to tell how many times each letter appears. The output format is like "X:N". Output a blank line after each test case. More details in sample output.
 
Sample Input
hello, this is my first acm contest! work hard for hdu acm.
 
Sample Output
a:1 b:0 c:2 d:0 e:2 f:1 g:0 h:2 i:3 j:0 k:0 l:2 m:2 n:1 o:2 p:0 q:0 r:1 s:4 t:4 u:0 v:0 w:0 x:0 y:1 z:0 a:2 b:0 c:1 d:2 e:0 f:1 g:0 h:2 i:0 j:0 k:1 l:0 m:1 n:0 o:2 p:0 q:0 r:3 s:0 t:0 u:1 v:0 w:1 x:0 y:0 z:0
 
Author
Ignatius.L
 
Source
杭州电子科技大学第三届程序设计大赛

 #include <stdio.h>
#include <stdlib.h>
#include <string.h> int main()
{
char a[];
int i,b[],k,j;
while(gets(a))
{
int b[]={};
j=strlen(a);
for(i=;i<j;i++)
{
k=a[i]-'a';
b[k]++;
}
printf("a:%d\nb:%d\nc:%d\nd:%d\ne:%d\nf:%d\ng:%d\nh:%d\ni:%d\nj:%d\nk:%d\nl:%d\nm:%d\nn:%d\no:%d\np:%d\nq:%d\nr:%d\ns:%d\nt:%d\nu:%d\nv:%d\nw:%d\nx:%d\ny:%d\nz:%d\n\n",b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[],b[]);
}
return ;
}

最新文章

  1. URL处理几个关键的函数parse_url、parse_str与http_build_query
  2. SpringMVC,3种不同的URL路由配置方法
  3. 从数学角度看最大期望(EM)算法 II
  4. 20145215《Java程序设计》课程总结
  5. Power-BI For K3 免费版培训与交流!Q群视频培训,绝对干货!
  6. oracle数据库表空间文件收缩实例
  7. editplus 使用小技巧
  8. J - A Bug&#39;s Life - poj2492
  9. Activiti工作流学习-----基于5.19.0版本(5)
  10. Java 重入锁 ReentrantLock
  11. 解决:java.io.IOException: No FileSystem for scheme: hdfs
  12. Python中tuple的功能介绍
  13. 认识Js中的二进制数据
  14. Part-Eight 模板与群体数据的组织
  15. .Net Core 简单定时任务框架封装
  16. Linux command parted
  17. Alpha 冲刺五
  18. 双语:Interprocess Communication 进程通信
  19. Shiro系列(0) - 权限管理在J2EE企业级开发中的应用与实战
  20. 转换CLOB字段类型为VARCHAR2, lob类型不支持的sql语句

热门文章

  1. CentOS 下安装apt-get
  2. iframe标签flash遮盖页面元素问题——wmode参数
  3. spring slf4j log4j maven
  4. 做一个视频播放器在没开始播放的时候有一张图片实际上就是拿一张图片盖住视频承载的屏幕当出发。play的时候图片隐藏 img
  5. input输入框只允许输入数字/ 数字+小数点/ 文字+字母/ 等解决方法
  6. Linux入门(三)搭建服务器linux运行环境LAMP/LNMP
  7. Java 序列化 对象序列化和反序列化
  8. submit 防止重复提交 --禁止提交
  9. 参考C++STL标准库中对了的使用方法
  10. boost 编译依赖库