hello i need help about getting the Unique characters from inputed String.. in Turbo Pascal...thanks in advance!

Sample Output:

Enter a String: Mississippi
Unique Characters: Misp

any clue or ideas...or simply the code...
:-)

What do you have so far ?

What do you have so far ?

uses crt;

var
i,z,j,y:integer;
word : string;


begin
clrscr;

z:=0;

write('Enter a String: ');
readln(word);

z:=length(word);


for i := 1 to z do
begin

for j:=i+1 to z do
begin

if word = word[j] then
begin
delete(word,j,1);
word:=word;
z:=length(word);

end;
end;
end;

for y :=1 to z do
begin
write(word[y]);
end;

readln;
end.


i Enter: Mississippi
but it displays: Missp

hope you can help me...thank you..!

var
  i: integer;
  Source, Dest: string;
  Chars: array[32..127] of Char;
begin
  try
    Source := '';
    Dest := '';
    ReadLn(Source);
    for i := 1 to Length(Source) do
        if not (Chars[Ord(Source[i])] <> '') then
        begin
           Chars[Ord(Source[i])] := Source[i];
           Dest := Dest + Source[i];
        end;
    WriteLn(Dest);
end;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.