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. hdu 1215 七夕节

    Problem Description 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!" ...

  2. vector -1

    vector的特色有支持随机存取,在集合尾端增删元素很快,但是在集合中间增删元素比较费时. vector以模板(泛型)方式实现,可以保存任意类型的变数,包括使用者自定义的资料型态,例如:它可以是放置整 ...

  3. [Leetcode] implement strStr() (C++)

    Github leetcode 我的解题仓库   https://github.com/interviewcoder/leetcode 题目: Implement strStr(). Returns ...

  4. 在java中生成二维码,并直接输出到jsp页面

    在java中生成的二维码不存到磁盘里要直接输出到页面上,这就需要把生成的二维码直接以流的形式输出到页面上,我用的是myeclipse 和 tomcat 它的原理是:在加载页面时,根据img的src(c ...

  5. nginx 504 Gateway Time-out错误解决办法

    我们经常会发现大量的nginx服务器访问时会提示nginx 504 Gateway Time-out错误了,下面我来总结了一些解决办法,有需要了解的同学可进入参考. 一般看来, 这种情况可能是由于ng ...

  6. 使用注解@Transient使表中没有此字段

    注意,实体类中要使用org.springframework.data.annotation.Transient 在写实体类时发现有加@Transient注解的 加在属性声明上,但网上有加到get方法上 ...

  7. 用Python制作markdown编辑器

    还记得在上篇提到的rest-framework,文档中提到了markdown也是可选应用. 那么这篇我们就来尝试使用markdown来制作一个在线的可以预览的editor. 安装 Python Mar ...

  8. VS2010中<无法打开包括文件:“iostream.h”:>错误解决方法

    C/C++ code? 1 2 #include <iostream.h> 改为: C/C++ code? 1 2 #include <iostream> using name ...

  9. Linux驱动开发相关

    一般用printk 查看/etc/sysconf文件,看看内核调试信息放到了哪里 打印的消息一般放在/var/log/messages文件里面. 如果你是在X Windows下的XTerm中insmo ...

  10. Android 中的接口回调

    http://blog.csdn.net/wangjinyu501/article/details/22052187   在Android中到处可见接口回调机制,尤其是UI事件处理方面.举一个最常见的 ...