【問題C18】:計算任兩英文字母接連出現的頻率。 [回前頁]
輸入一篇英文文章,計算文中任兩英文字母接連出現的頻率,亦即@A,A@,AA,AB,AC,﹒﹒﹒﹒,AZ,@B,B@,BA,BB,BC,﹒﹒﹒﹒,BZ,﹒﹒﹒﹒﹒﹒﹒﹒﹒﹒﹒,ZZ等出現的次數。其中@A代表A為一英文單字的第一個字母;A@代表A為一英文單字的最後一個字母,餘類推。
按其頻率之高低排序後,將頻率不為零的依序列印出來。
【輸入】THIS IS HIS BOOK
【輸出】
IS:3 S@:3 HI:2 @B:1
@H:1 @I:1 @T:1 BO:1
k@:1 OK:1 OO:1 TH:1
【輸入】
SOFTWARE CONSISTS OF THE PROGRAMS A COMPUTER
SYSTEM EXECUTES.
THERE ARE TWO KINDS OF SORTWARE;SYSTEM
SOFTWARE AND APPLICATIONS SOFTWARE.
SYSTEM SOFTWARE CONSISTS OF PROGRAMS THAT HELP
USERS WRITE AND EXECUTE OTHER PROGRAMS.
APPLICATIONS SOFTWARE DOES THE JOBS THAT USERS
BROUGHT THE COMPUTER TO HANDLE.
APPLICATIONS SOFTWARE IS AS VARIED AS THE
APPLICATIONS OF COMPUTERS THEMSELVES.
【輸出】
?