hep salut a tous

j'ai fais un petit programme qui trie les lettres dans une chaine string

comment faire pour que celui ci compte les occurences dans la chaine celle-ci un fois trié ??

merci d'avance... ps c'est pour mon examen de demain alors aidez moi

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
program Sceance7ChaineCaractere;
 
{scéance 7.F - Chaine caractère}
 
{réalisation Sebastien Degreve - http://online.freezee.org}
 
 
{-------------DECLARATION-----------------}
var
    mot: string;
    lengths,pos,i,j: integer;
    t : array [1..26] of char;
    tampon : char;
 
{---------------PROGRAMME-------------------}
 
begin
  writeln('entrez une chaine de caracteres');
  readln(mot);
  lengths := length(mot);
  for i:=1 to lengths do
   begin
     t[i] := upcase(mot[i]);
   end;
 for i:=1 to lengths-1 do
  begin
   pos:=i;
   for j:=i+1 to lengths do
    if t[j]<t[pos] then pos:=j;
     if pos<>i
     then
     begin
     tampon:=t[i];
     t[i]:=t[pos];
     t[pos]:=tampon;
     end;
    end;
   for i:=1 to lengths do
    begin
    write(t[i]);
    write(' ');
    end;
 readln;
end.