499 - What's The Frequency, Kenneth?
来源:互联网 发布:淘宝云客服操作平台 编辑:程序博客网 时间:2024/05/18 03:23
What's The Frequency, Kenneth?
#include <stdio.h>main(){ int i; char *suffix[]= { "st", "nd", "rd" }; char *item[]= { "Unix" , "cat", "sed", "awk", "grep", "ed", "vi"}; printf("In the beginning, there was nothing.\n"); for (i= 0; i < 7; i++) printf("And on the %d%s day, God created %s. And it was good.\n", i + 1, (i < 3) ? suffix[i] : "th", item[i]);}
But then God saw that vi led people into temptation. Instead of choosing the righteous ways ofmake,dbx, and RCS, people used long command lines, printf(), and tape backups.
So God decreed, ``I see that Engineers have thus defiled my vi. And so, I shall createemacs, an editormore powerful than words. Further, for each instantiationvi hitherto, the Engineer responsible shalt performPenance. And lo, the Penance wilt be painful; there will be much wailing and gnushingof teeth. The Engineerwill read many lines of text. For each line of text, the Engineer must tell me which letters occur the most frequently.''
``I charge you all with My Golden Rule: 'Friends shalt not let friends use vi'.''
Input and Output
Each line of output should contain a list of letters that all occured with the highest frequency in the corresponding input line, followed by the frequency.
The list of letters should be an alphabetical list of upper case letters followed by an alphabeticallist of lower case letters.
Sample Input
When riding your bicycle backwards down a one-way street, if thewheel falls of a canoe, how many ball bearings does it take to fillup a water buffalo?Hello Howard.
Sample Output
e 6al 7a 3Hlo 2
#include<stdio.h>#include<string.h>int max(int *a){int i,max=0;for(i=0;i<52;i++)if(a[i]>max) max=a[i];return max;}int main(void){char a[100]={0};while((gets(a))!=NULL){int count[52]={0},i;for(i=0;i<strlen(a);i++){if(a[i]<='z'&&a[i]>='a')count[a[i]-'a'+26]++;else if(a[i]<='Z'&&a[i]>='A')count[a[i]-'A']++;}for(i=0;i<52;i++)if(count[i]==max(count)){if(i<26)putchar(i+'A');elseputchar(i+'a'-26);}printf(" %d\n",max(count));}return 0;}
- 499 - What's The Frequency, Kenneth?
- UVa 499 - What's The Frequency, Kenneth?
- what's the Soft3M
- What's the CCIR601?
- What’s the jiffy?
- What's the J2EE?
- What's the JPA?
- What's the CRUD?
- What's the AOP?
- what's the team
- What's the LDAP?
- what's the Glide
- What's the WAR
- What's the career direction?
- CSDN, what's the meaning.
- What's the wether like?
- What's the true life
- what's the real life?
- 十六周上机任务(一)
- 论文阅读笔记 - Mesos: A Platform for Fine-Grained ResourceSharing in the Data Center
- UINavigationController使用详解
- 客户端用不用bind 的区别
- 装饰模式
- 499 - What's The Frequency, Kenneth?
- android权限
- datastax java driver for cassandra 入门
- 关键词屏蔽算法之一:DFA
- opencv(一) Mat结构访问
- hibernate使用sql得到非实体结果集
- qq 客服
- pjsip简介
- 浅谈C#中的泛型