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

题的大概意思就是计算a-z出现的次数;

代码:

#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
using namespace std;
int main()
{ int a[27];char c;
string st;
while(getline(cin,st)){
memset(a,0,sizeof(a));
for(int i=0;i<st.size();i++)
if(st[i]>='a'&&st[i]<='z')
a[st[i]-97]++;
for(int i=0;i<26;i++)
{
c=i+97;
cout<<c<<":"<<a[i]<<endl;
}
cout<<endl;
}
return 0; }

hdu1219的更多相关文章

  1. 【HDU1219】AC Me(水题)

    BUPT2017 wintertraining(16) #4 A HDU1219 题意 多组样例,每组给一行,输出该行各字母个数,每组输出之间输出空行 代码 #include <cstdio&g ...

  2. OJ题目分类

    POJ题目分类 | POJ题目分类 | HDU题目分类 | ZOJ题目分类 | SOJ题目分类 | HOJ题目分类 | FOJ题目分类 | 模拟题: POJ1006 POJ1008 POJ1013 P ...

  3. 2019的hdu暑假作业(欢迎纠错)

    1219 遍历计数. #include<bits/stdc++.h> #define QAQ 0 using namespace std; ]; ]; int main(){ )){ me ...

随机推荐

  1. 最小生成树prim算法———模板

    codevs.cn 最优布线问题 #include<cstdio>#include<cstring> bool u[101]; int g[101][101],minn[101 ...

  2. ESP8266固件烧录方法

    今天拿到ESP8266的板子,第一步是进行烧录固件. 首先是使用官方自带的参考文档,进行操作.发现每次烧录均卡在等待同步上电. 之后发现是烧录方法错误. 正确的烧录方法: 先按下FLASH不放,再按烧 ...

  3. sql 数据库备份还原脚本

    /**功能:数据库备份*dbname:数据库名称*bakname:备份名称,包含完整路径*/use master BACKUP DATABASE dbname TO disk='c:\bakName' ...

  4. 高效的jQuery代码编写技巧总结

    最近写了很多的js,虽然效果都实现了,但是总感觉自己写的js在性能上还能有很大的提升.本文我计划总结一些网上找的和我本人的一些建议,来提升你的jQuery和javascript代码.好的代码会带来速度 ...

  5. asp.net mvc4 easyui datagrid 增删改查分页 导出 先上传后导入 NPOI批量导入 导出EXCEL

    效果图 数据库代码 create database CardManage use CardManage create table CardManage ( ID ,) primary key, use ...

  6. Blogger建立新文章 - Blog透视镜

    使用Blogger,建立好Blog部落格之后,接着就是建立新文章,它是Blog部落格的灵魂,先从简单开始,来了解建立新文章的标题,文章中如何上传图片,建立卷标,及设定排程日期,定时自动发布等这些功能, ...

  7. LeetCode_String to Integer (atoi)

    Implement atoi to convert a string to an integer. int atoi (const char * str); Convert string to int ...

  8. 购物车Demo,前端使用AngularJS,后端使用ASP.NET Web API(1)--后端

    原文:购物车Demo,前端使用AngularJS,后端使用ASP.NET Web API(1)--后端 chsakell分享了前端使用AngularJS,后端使用ASP.NET Web API的购物车 ...

  9. ajax 调用后台接口示例

    $(function(){ var _del_time_list = $("select[name='del_time_list']"); var _del_table_name ...

  10. Spiral Matrix 解答

    Question Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in ...