UVA-499 - What's The Frequency, Kenneth?
21 May 2018
- UVa Online Judge 解題結果請於 Submit 後,參閱 uHunt。
- 如果你有任何建議與指教,歡迎於下方留言一起討論喔!
- 本題選為「20160524 大學程式能力檢定 CPE」題目。
題意概要
試求:每一行文字中「出現頻率最多」的大小寫英文字母,若有一樣多的字母,則按照 A - Z、a - z 的順序輸出。
- 分析:本題為簡單的字串處理問題。在 ASCII 中,字母 A - Z 與 a - z 並沒有連續在一起,因此需要分別進行計數。
Input
The input file consists of a lot of lines of text.
Output
A 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 alphabetical list of lower case letters.
Sample Input
When riding your bicycle backwards down a one-way street, if the
wheel falls of a canoe, how many ball bearings does it take to fill
up a water buffalo?
Hello Howard.
Sample Output
e 6
al 7
a 3
Hlo 2