program oken; uses crt; var s:string; i,j,dem,k: longint; sl: array[1..1000000] of longint; a: array[1..1000000] of char; begin clrscr; write(‘Nhap xau: ‘); readln(s); k:=0; for i:=32 to 126 do begin dem:=0; for j:=1 to length(s) do if chr(i)=s[j] then dem:=dem+1; if dem<>0 then begin k:=k+1; a[k]:=chr(i); sl[k]:=dem; end; end; for i:=1 to k do writeln(a[i],’: ‘,sl[i]); readln; end.
program solanxuathien;
uses crt;
var st:string;
function dem(c:char; s:string):byte;
var l:byte;
begin
dem:=0;
for l:=1 to length(s) do
if s[l]=c then inc(dem);
end;
procedure xuly;
var i,n:byte;
kt:char;
begin
write(‘Nhap xau: ‘); readln(st);
i:=1; n:=length(st);
while n>0 do
begin
kt:=st[1];
writeln(st[i],’: ‘,dem(st[i],st));
while pos(kt,st)<>0 do
begin
delete(st,pos(kt,st),1);
n:=n-1;
end;
end;
readln
end;
BEGIN
clrscr;
xuly;
end.
program oken;
uses crt;
var s:string;
i,j,dem,k: longint;
sl: array[1..1000000] of longint;
a: array[1..1000000] of char;
begin
clrscr;
write(‘Nhap xau: ‘); readln(s);
k:=0;
for i:=32 to 126 do
begin
dem:=0;
for j:=1 to length(s) do
if chr(i)=s[j] then
dem:=dem+1;
if dem<>0 then
begin
k:=k+1;
a[k]:=chr(i);
sl[k]:=dem;
end;
end;
for i:=1 to k do
writeln(a[i],’: ‘,sl[i]);
readln;
end.