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. lightOJ1370 欧拉函数性质

    D - (例题)欧拉函数性质 Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:32768KB     ...

  2. 另类的package-info.java文件探讨

    原文地址:http://strong-life-126-com.iteye.com/blog/806246 翻看以前的笔记,看到一个特殊的java文件:pacakge-info.java,虽然有记录, ...

  3. 实现Web虚拟现实的最轻松方案—A-Frame框架

    问题 随着vr的热度那么web虚拟现实是否可行 1. 实现Web虚拟现实的最轻松方案 A-Frame A-Frame是一款开源的可通过定制HTML元素构建WebVR方案的框架.有了这个框架,Web程序 ...

  4. C# 向批处理文件输入字符

    先记录个无关标题哒~ 刚刚学习用C#,在用VS进行图形界面编程时,点界面中添加的空间,VS界面右侧会出现该控件的属性页,但是这个属性页并不全, 只列出了部分重要的属性,一开始还以为是没有对应的属性方法 ...

  5. 【4】python核心编程 第七章-映射和集合类型

    1.映射类型的相关函数 函数 操作 dict([container]) 创建字典的工厂函数.如果提供了容器类(container) , 就 用其中的条目填充字典,否则就创建一个空字典. len(map ...

  6. 让WordPress的作者在后台只能看到自己的文章

    今天需要对WordPress后台进行调整,目的是为了只能让当前用户看见自己所发表的文章,而WordPress默认是登陆用户可以看到所有用户发表的文章. WordPress中的用户角色分的比较详细,作者 ...

  7. [TYVJ] P1025 单数?双数?

    单数?双数? 背景 Background USACO OCT09 1ST   描述 Description Bessie那惨无人道的二年级老师搞了一个有 N (1 <= N <= 100) ...

  8. linux安装xunsearch

    首先要确保ubuntu安装了gcc g++ make sudo apt-get install make gcc g++ 然后安装zlib,用来解压的: apt-get install zlib1g- ...

  9. Eclipse代码提示功能设置(Java & Eclipse+CDT C/C++)

    http://developer.51cto.com/art/200907/136242.htm http://blog.chinaunix.net/u/21684/showart_462486.ht ...

  10. cf486A Calculating Function

    A. Calculating Function time limit per test 1 second memory limit per test 256 megabytes input stand ...