Pascal – delete spaces from input text

So I just started learning Pascal and have problems understanding how deleting specific characters works

program Project1;
var
  a:string;
  b:char;
  c:integer;


begin
  readln(a);
  b:=(chr(32));

  for c:=1 to length(a) do
  begin
    if a[c]=b then delete;
  end;
   readln;
end.                          

The idea is that I input random text and get back the same text but without all spaces. Sounds simple but I just started learning pascal, so not really. Help would be appreciated :)
Probably more than one thing is wrong with this sh*t code.