Text generation

This code generates text based on this principle:

There is a template for example:

Ru.stackoverflow.com - {best|cool / amazing} forum - {2019/2020/2022} of the year

After that, the generation goes only for the first keywords that are between the {} brackets, that is, so:

ru.stackoverflow.com - лучший форум - {2019|2020|2022} года
ru.stackoverflow.com - классный форум - {2019|2020|2022} года
ru.stackoverflow.com - восхитительный форум -{2019|2020|2022} года
ru.stackoverflow.com - 2020 форум - {2019|2020|2022} года
ru.stackoverflow.com - 2022 форум - {2019|2020|2022} года

How to fix the code so that the generation goes through the entire template, that is, to get the output:

ru.stackoverflow.com - лучший форум - 2019 года
ru.stackoverflow.com - классный форум - 2020 года
ru.stackoverflow.com - восхитительный форум - 2022 года
ru.stackoverflow.com - 2020 форум - 2019 года
ru.stackoverflow.com - 2022 форум - 2020 года

Here, in fact, is the code:

var
 s: string;
 ss: Tstringlist;
 i: integer;
begin
 ss:= Tstringlist.Create;
 s:=memo1.Lines.Strings[0];
 delete(S,1,pos('{',S));
 while pos('|',S)<>0 do
  Begin
   ss.Add(copy(S,1,pos('|',S)-1));
   delete(S,1,pos('|',S));
  End;
 ss.Add(copy(S,1,pos('}',S)-1));
 s:=copy(memo1.Lines.Strings[0],1,pos('-',memo1.Lines.Strings[0])-2);
 ss.Add(copy(memo1.Lines.Strings[0],
             pos('}',memo1.Lines.Strings[0])+2,
             length(memo1.Lines.Strings[0])));
 for i:=0 to ss.count-2 do
  memo1.Lines.Add(s+' '+ss.Strings[i]+' '+ss.Strings[ss.count-1]);
end;
end.
Author: Skeggi, 2020-12-18