Jump to content

Reverse words in a string: Difference between revisions

Line 108:
 
=={{header|Aime}}==
<lang aime>integer i, j, s;
list l, x;
text s, t;
data b;
file f;
 
l = list("Frost Robert ----------- Ice and Fire ------------");,
l_bill(l, 0,
"---------- Ice and Fire ------------",
"fire, in end will world the say Some",
"fire,ice. in end will world the say Some",
"ice.desire of tasted inI've saywhat SomeFrom",
"desirefire. offavor tastedwho I'vethose whatwith Fromhold I",
"fire. favor who those with hold I",
"... elided paragraph last ...",
"... elided paragraph last ...",
"Frost Robert -----------------------",);
"Frost Robert -----------------------");
 
for (, t in l) {
i = -l_length(l);
file().b_affix(t).list(x, 0);
while (i) {
b_castfor (bj, l[i]s in x.reverse); {
o_space(ssign(j));
f_b_affix(f, b);
f_list(f, x, 0 o_text(s);
j = l_length(x);
s = 0;
while (j) {
o_space(s);
s = 1;
o_text(x[j -= 1]);
}
o_newline();
i += 1;
}</lang>
{{out}}
Line 151 ⟶ 142:
 
----------------------- Robert Frost</pre>
 
 
=={{header|ALGOL 68}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.