Letter frequency: Difference between revisions
Content deleted Content added
Line 563:
declare in file;
open file (in) title ('
on endfile (in) go to prepare_list;
Line 574:
prepare_list:
put skip list('Letter', 'Frequency');
do i = 1 to 26;
if tallies(i) > 0 then
put skip list (substr(alphabet, i, 1), tallies(i));
end;
end frequencies;</lang>
Data:
</lang>▼
<pre>
THEQUICKBROWNFOX
JUMPSOVERTHELAZYDOG
Output:
<pre>
Letter Frequency
A 1
B 1
C 1
D 1
E 3
F 1
G 1
H 2
I 1
J 1
K 1
L 1
M 1
N 1
O 4
P 1
Q 1
R 2
S 1
T 2
U 2
V 1
W 1
X 1
Y 1
Z 1
</pre>
=={{header|Prolog}}==
|