program ideone;
uses
SysUtils;
var
posicao, i: Integer;
posicoes: Array of Integer;
texto: String;
begin
texto := 'teste>para encontrar > na string >';
while (Pos('>', texto) > 0) do // Verifica se tem '>' na variável texto
begin
SetLength(posicoes, Length(posicoes) + 1); // Aumenta um espaço no array
posicao := Pos('>', texto); // Pega a posição do primeiro >
posicoes[High(posicoes)] := posicao; // Armazena a posição no ultimo espaço do array
texto[posicao] := ' '; // Substitui o > por espaço
end;
// A partir deste ponto você terá todas as posições dos '>' dentro do array posicoes
WriteLn('Posições:'); // Imprimir o texto "Posições:" na tela
for i := 0 To High(posicoes) do // Percorrer o array posicoes
WriteLn(IntToStr(posicoes[i])); // Converter o conteudo para string e imprimir na tela
end.
cHJvZ3JhbSBpZGVvbmU7Cgp1c2VzCiAgU3lzVXRpbHM7Cgp2YXIKICBwb3NpY2FvLCBpOiBJbnRlZ2VyOwogIHBvc2ljb2VzOiBBcnJheSBvZiBJbnRlZ2VyOwogIHRleHRvOiBTdHJpbmc7CgpiZWdpbgogIHRleHRvIDo9ICd0ZXN0ZT5wYXJhIGVuY29udHJhciA+IG5hIHN0cmluZyA+JzsKCiAgd2hpbGUgKFBvcygnPicsIHRleHRvKSA+IDApIGRvIC8vIFZlcmlmaWNhIHNlIHRlbSAnPicgbmEgdmFyacOhdmVsIHRleHRvCiAgYmVnaW4KICAgIFNldExlbmd0aChwb3NpY29lcywgTGVuZ3RoKHBvc2ljb2VzKSArIDEpOyAvLyBBdW1lbnRhIHVtIGVzcGHDp28gbm8gYXJyYXkKICAgIHBvc2ljYW8gOj0gUG9zKCc+JywgdGV4dG8pOyAvLyBQZWdhIGEgcG9zacOnw6NvIGRvIHByaW1laXJvID4KICAgIHBvc2ljb2VzW0hpZ2gocG9zaWNvZXMpXSA6PSBwb3NpY2FvOyAvLyBBcm1hemVuYSBhIHBvc2nDp8OjbyBubyB1bHRpbW8gZXNwYcOnbyBkbyBhcnJheQogICAgdGV4dG9bcG9zaWNhb10gOj0gJyAnOyAvLyBTd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