fork download
  1. /* Histogram of Frequency of Different Characters in Input */
  2.  
  3. #include<stdio.h>
  4. #define TNOCHAR 128 /* Total Number of characters is 128: 0 - 127 */
  5.  
  6. int main(void)
  7. {
  8. int c,i,j;
  9.  
  10. int character[TNOCHAR];
  11.  
  12. for(i=0;i<TNOCHAR;++i)
  13. character[i] = 0;
  14.  
  15. while((c=getchar())!=EOF)
  16. ++character[c];
  17.  
  18. for(i=0;i<TNOCHAR;++i)
  19. {
  20. putchar(i);
  21.  
  22. for(j=0;j<character[i];++j)
  23. putchar('*');
  24.  
  25. putchar('\n');
  26. }
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 2160KB
stdin
Standard input is empty
stdout









	























 
!
"
#
$
%
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
\
]
^
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~