HDU 1219 AC Me(字母统计)
来源:互联网 发布:我爱你韩国知乎 编辑:程序博客网 时间:2024/05/22 00:46
AC Me
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15502 Accepted Submission(s): 6747
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.
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.
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.
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:1b:0c:2d:0e:2f:1g:0h:2i:3j:0k:0l:2m:2n:1o:2p:0q:0r:1s:4t:4u:0v:0w:0x:0y:1z:0a:2b:0c:1d:2e:0f:1g:0h:2i:0j:0k:1l:0m:1n:0o:2p:0q:0r:3s:0t:0u:1v:0w:1x:0y:0z:0
Author
Ignatius.L
AC代码;
#include<iostream>#include<cstdlib>#include<cstdio>#include<cmath>#include<cstring>#include<string>#include<cstdlib>#include<algorithm>typedef long long LL;using namespace std;int main(){char c[100005]; while(gets(c)){ int b[27]={0};int k=strlen(c); for(int i=0;i<k;i++) if(c[i]>='a'&&c[i]<='z') b[c[i]-'a']++; for(int i=0;i<26;i++) printf("%c:%d\n",i+'a',b[i]); puts(""); }return 0;}
1 0
- HDU 1219 AC Me(字母统计)
- (hdu 简单题 128道)AC Me(统计一行文本中各个字母出现的次数)
- hdu 1219 AC Me
- hdu 1219 AC Me
- hdu 1219 AC Me
- HDU 1219 AC Me
- hdu 1219 AC Me
- HDU 1219 AC Me
- hdu-1219-AC Me
- HDU 1219AC Me
- HDU 1219 AC Me
- hdu 1219 AC Me
- hdu-1219 AC Me
- HDU 1219 AC Me
- HDU 1219 AC Me
- HDU 1219 AC Me
- HDU-1219 AC Me (水)
- hdu-oj 1219 AC Me
- Repeat和AspNetPager控件
- Android Service
- Android UI优化之include标签的使用
- atexit()函数的使用
- Android多线程与线程池
- HDU 1219 AC Me(字母统计)
- ZOJ Problem Set - 3938 (模拟)
- SQL
- Linux文件与文件系统的压缩与打包
- C语言中.h和.c文件解析(很精彩)
- OC可变数组(NSMutableArray)相关方法
- Ajax和JSON
- LeetCode - Reverse Vowels of a String
- ArrayList、HashTable到JSON