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. 8 Hbase get方式获取数据

    package com.hikvision.hbase.vertify.test; import org.apache.hadoop.conf.Configuration; import org.ap ...

  2. hdu 1262寻找素数对

    Problem Description 哥德巴赫猜想大家都知道一点吧.我们现在不是想证明这个结论,而是想在程序语言内部能够表示的数集中,任意取出一个偶数,来寻找两个素数,使得其和等于该偶数. 做好了这 ...

  3. VC++下使用SQLite数据库

    老师最近给的上机题目有点变态,特别是写到最后,是需要写学生管理系统.如果C语言结合文件来操作的话,估计会比较麻烦(对文件里字符串的增删改查我都没有什么好点的算法).那就用数据库吧,我很自然的想到. 前 ...

  4. 操作html标签之找到标签(续)

    为了方便我们快速地找到一些特殊的元素,js提供了几个有用的东东. 1.快速找到根元素:document.documentElement和document.body. 2.obj.parentNode: ...

  5. 执行yiic webapp命令时报错:php.exe不是内部或外部命令,也不是可运行的程序

    在执行 yiic webapp ../abc 命令时报错: “php.exe”不是内部或外部命令,也不是可运行的程序 或批处理文件. 这是因为yiic批处理程序找不到php.exe的执行路径引起的. ...

  6. ListView 实现分组

    1:FragmentHack4.java /** * Created by y on 15-1-2. */ public class FragmentHack4 extends Fragment{ V ...

  7. Android使用xml中定义的动画效果

    Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.zqrl_out); animation.setFil ...

  8. BZOJ 1977 次小生成树(最近公共祖先)

    题意:求一棵树的严格次小生成树,即权值严格大于最小生成树且权值最小的生成树. 先求最小生成树,对于每个不在树中的边,取两点间路径的信息,如果这条边的权值等于路径中的权值最大值,那就删掉路径中的次大值, ...

  9. 【给你几个使用Xamarin的理由】

    写在开篇前 这种代理操作,绑定影射的机制,有些极端的开发者确实难以接受.追求完美,总感觉原生的各种优点. 如果你非得较这个真,那您还是感觉补习下 Java Eclipse  ,买一台Mac 恶补Obj ...

  10. NSIS脚本根据操作系统版本动态决定默认安装目录

    问题描述: 因为windows XP和windows 7的program files不同(有program files(x86)),所以需要动态根据系统的位数设置默认安装目录 References: ...