PAT (Basic Level) Practise (中文)1042. 字符统计(20) C语言
来源:互联网 发布:淘宝怎样设置客服 编辑:程序博客网 时间:2024/06/11 12:03
1042. 字符统计(20)
时间限制
400 ms
内存限制
65536 kB
代码长度限制
8000 B
判题程序
Standard
作者
CHEN, Yue
请编写程序,找出一段给定文字中出现最频繁的那个英文字母。
输入格式:
输入在一行中给出一个长度不超过1000的字符串。字符串由ASCII码表中任意可见字符及空格组成,至少包含1个英文字母,以回车结束(回车不算在内)。
输出格式:
在一行中输出出现频率最高的那个英文字母及其出现次数,其间以空格分隔。如果有并列,则输出按字母序最小的那个字母。统计时不区分大小写,输出小写字母。
输入样例:This is a simple TEST. There ARE numbers and other symbols 1&2&3...........输出样例:
e 7
#include<stdio.h>#include<string.h>int main(){char alphabet[256]={0};char string[1010]={0};char temp;int i,max=0,index;gets(string);for(i=0;i<strlen(string);i++){alphabet[string[i]]++;}for(i=65;i<91;i++){alphabet[i+32]+=alphabet[i];}for(i=97;i<123;i++){if(alphabet[i]>max){max=alphabet[i];index=i;}}printf("%c %d",index,max);return 0;}
0 0
- PAT (Basic Level) Practise (中文)1042. 字符统计(20) C语言
- PAT (Basic Level) Practise (中文)1042. 字符统计(20)
- PAT (Basic Level) Practise (中文) 1042. 字符统计(20)
- PAT (Basic Level) Practise (中文)1042. 字符统计(20)
- PAT (Basic Level) Practise (中文)1021. 个位数统计 (15) C语言
- PAT (Basic Level) Practise (中文)1044. 火星数字(20) C语言
- PAT (Basic Level) Practise (中文)1022. D进制的A+B (20) C语言
- PAT (Basic Level) Practise (中文)1002. 写出这个数 (20) C语言
- PAT (Basic Level) Practise (中文)1003. 我要通过!(20) C语言
- PAT (Basic Level) Practise (中文)1024. 科学计数法 (20) C语言
- PAT (Basic Level) Practise (中文)1004. 成绩排名 (20) C语言
- PAT (Basic Level) Practise (中文)1007. 素数对猜想 (20) C语言
- PAT (Basic Level) Practise (中文)1008. 数组元素循环右移问题 (20) C语言
- PAT (Basic Level) Practise (中文)1012. 数字分类 (20) C语言
- PAT (Basic Level) Practise (中文)1013. 数素数 (20) C语言
- PAT (Basic Level) Practise (中文)1017. A除以B (20) C语言
- PAT (Basic Level) Practise (中文)1023. 组个最小数 (20)C语言
- PAT (Basic Level) Practise (中文)1027. 打印沙漏(20) C语言
- leetcode: (283) Move Zeroes
- Linux su与su-指令差别
- Mirillis Action! 1.22.0 简体中文破解版(高清屏幕录像软件)
- zenoss监控安装
- .Net 通用防注入代码
- PAT (Basic Level) Practise (中文)1042. 字符统计(20) C语言
- 构建超过65535方法数的安卓程序
- Firefox OS中Geolocation的实现
- 超炫圆形旋转菜单Android-CircleMenu
- 面试心得与总结---BAT、网易、蘑菇街
- 使用整数数据的精确数字数据类型。
- PAT (Basic Level) Practise (中文)1043. 输出PATest(20) C语言
- 解决友盟社会化分享SDK 导致的Activity泄露
- Linux下执行Oracle语句中文乱码