RosettaCodeData/Task/Reverse-words-in-a-string/Seed7/reverse-words-in-a-string.seed7
2023-07-01 13:44:08 -04:00

28 lines
701 B
Text

$ include "seed7_05.s7i";
const array string: lines is [] (
"---------- Ice and Fire ------------",
"",
"fire, in end will world the say Some",
"ice. in say Some",
"desire of tasted I've what From",
"fire. favor who those with hold I",
"",
"... elided paragraph last ...",
"",
"Frost Robert -----------------------");
const proc: main is func
local
var string: line is "";
var array string: words is 0 times "";
var integer: index is 0;
begin
for line range lines do
words := split(line, ' ');
for index range length(words) downto 1 do
write(words[index] <& " ");
end for;
writeln;
end for;
end func;