Write a program to find the most frequent English letter in a given text.
Input format:
The input gives a string with a length of not more than 1000 in a row. The string consists of any visible characters and spaces in the ASCII code table, containing at least 1 English letters, ending with a carriage return (carriage return does not count).
Output format:
Outputs the most frequently occurring English letter in a row and its occurrences, separated by a space. If there is a tie, the letter with the smallest alphabetical order is output. Statistics are case insensitive and output lowercase letters.
Input Sample:
This was a simple TEST. There is numbers and other symbols 1&2&3 .....
Sample output:
E 7
1#include <stdio.h>2#include <string.h>3#include <stdlib.h>4#include <ctype.h>5#include <math.h>6 7 intMain () {8 inta[ +]={0};9 Charb[1010];Ten gets (b); One intLenB =strlen (b); A CharC; - for(intI=0; i<lenb;i++){ -B[i] =ToLower (B[i]); the } - for(intI=0; i<lenb;i++){ - if(b[i]<='Z'&&b[i]>='A'|| b[i]<='Z'&&b[i]>='a') -a[b[i]]++; + } - intMax =0; + for(intI=0;i< +; i++){ A if(a[i]>max) { atc =i; -Max =A[i]; - } - Else if(a[i]==max) { - if(i<c) { -c =i; inMax =A[i]; - } to + } - } theprintf"%c%d", C,max); *}
PAT 1042. Character Statistics (20)