杭电 OJ 1219 AC Me
来源:互联网 发布:灵格斯mac版 编辑:程序博客网 时间:2024/05/22 10:41
AC Me
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 19031 Accepted Submission(s): 8031
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#include<iostream>#include<string.h>using namespace std;int main(){ string s; char c[27]="abcdefghijklmnopqrstuvwxyz"; int b[26]={0}; int i,j; while(getline(cin,s)) { //int num; memset(b,0,sizeof(b)); unsigned long a=s.size(); for(i=0;i<a;i++) for(j=0;j<26;j++) { if(s[i]==c[j]) b[j]++; } for(i=0;i<26;i++) cout<<c[i]<<":"<<b[i]<<endl; cout << endl; } return 0;}
阅读全文
0 0
- 杭电 OJ 1219 AC Me
- 杭电oj—1219—AC Me
- 杭电ACM 1219 AC Me
- 杭电 HDU 1219 java AC Me
- 杭电 acm AC Me
- hdu-oj 1219 AC Me
- 杭电oj 1061题AC代码
- hdu 1219 AC Me
- hdu 1219 AC Me
- hdu 1219 AC Me
- HDU 1219 AC Me
- hdu 1219 AC Me
- HDU 1219 AC Me
- HDOJ 1219 AC ME
- hdu-1219-AC Me
- HDU 1219AC Me
- HUD 1219 AC Me
- hdoj 1219 AC Me
- Java中.getClass()和.class的区别
- Java设计模式学习07——桥接模式
- 排序算法---希尔排序(Shell Sort)
- Get方法中文传递参数乱码
- 神经网络与深度学习 1.3 神经网络的架构 1.4 一个简单的分类手写数字的网络架构
- 杭电 OJ 1219 AC Me
- TensorFlow使用说明
- HDU-1241-Oil Deposits
- [HAOI2008]移动玩具
- 栈与队列 解释与运用 讲解
- 局部加权回归
- DOM基础四
- Python学习笔记——元组,序列
- 责任链模式