题目1098:字母统计
来源:互联网 发布:voip软件电话 编辑:程序博客网 时间:2024/06/14 00:49
- 题目描述:
输入一行字符串,计算其中A-Z大写字母出现的次数
- 输入:
案例可能有多组,每个案例输入为一行字符串。
- 输出:
对每个案例按A-Z的顺序输出其中大写字母出现的次数。
- 样例输入:
DFJEIWFNQLEF0395823048+_+JDLSFJDLSJFKK
- 样例输出:
A:0B:0C:0D:3E:2F:5G:0H:0I:1J:4K:2L:3M:0N:1O:0P:0Q:1R:0S:2T:0U:0V:0W:1X:0Y:0
Z:0
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std; const int maxn=26;const int maxl=1000;int t[maxn];char s[maxl];int main(){ while(scanf("%s",s)!=EOF) { memset(t,0,sizeof(t)); for(int i=0;i<strlen(s);i++) if((s[i]>='A')&&(s[i]<='Z')) t[s[i]-'A']++; for(int i=0;i<maxn;i++) printf("%c:%d\n",'A'+i,t[i]); } return 0;}
0 0
- 题目1098:字母统计
- 题目1098:字母统计
- 题目1098:字母统计
- 题目1098:字母统计
- 题目1098:字母统计
- 题目1098:字母统计
- 题目1098:字母统计
- 九度OJ 题目1098:字母统计
- <九度 OJ>题目1098:字母统计
- 题目241 字母统计
- 题目241-字母统计
- 题目241-字母统计
- nyoj题目241:字母统计
- 九度题目1098:字母统计分享代码
- 九度 Online Judge 算法 刷题 题目1098:字母统计
- 南阳oj 题目241 字母统计
- 南阳OJ-题目241:字母统计
- 字母统计
- String
- 实现顺序表以及顺序表的简单运算
- 观察者模式
- Android sqlite3工具的使用
- SQL中N+1问题已经MyBaits中的解决方案
- 题目1098:字母统计
- 出现次数最多的数
- spark1.6.0+Hadoop2.6.0+Scala-2.11.7 搭建分布式集群
- 2014年普级组模拟试题一 五香豆腐
- 10017---Managing Solr Search Configuration
- Java FileInputStream没有读取文件会发生什么情况
- Block中的循环引用问题
- Educational Codeforces Round 11---B-Seating On Bus
- URI 与 URL、URN