fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. unsigned hist['Z'-'A'+2]={};
  6. for(char ch;(ch=getchar())!=EOF;++hist[isalpha(ch)?toupper(ch)-'A'+1:0]) {}
  7. for(char ch='A';ch<='Z';printf("%c: %u\n",ch,hist[ch-'A'+1]),++ch) {}
  8. return 0;
  9. }
  10.  
Success #stdin #stdout 0s 4244KB
stdin
#include <stdio.h>

int main(void) {
	unsigned hist['Z'-'A'+2]={};
	for(char ch;((ch=getchar())!='\n')&&(ch!=EOF);++hist[isalpha(ch)?toupper(ch)-'A'+1:0]) {}
	for(char ch='A';ch<='Z';printf("%c: %u\n",hist[++ch-'A'])) {}
	return 0;
}
stdout
A: 10
B: 0
C: 13
D: 4
E: 6
F: 4
G: 2
H: 16
I: 11
J: 0
K: 0
L: 2
M: 1
N: 9
O: 6
P: 4
Q: 0
R: 9
S: 6
T: 9
U: 5
V: 1
W: 0
X: 0
Y: 0
Z: 2