Anonymous user
Reverse words in a string: Difference between revisions
m
Broke apart a long (multi-sentence) paragraph into simpler/separate declaratives, added whitespace for readability, showed the task's requirement as a separate paragraph.
m (→{{header|REXX}}: added/changed whitespace and comments, added a 2nd REXX version.) |
m (Broke apart a long (multi-sentence) paragraph into simpler/separate declaratives, added whitespace for readability, showed the task's requirement as a separate paragraph.) |
||
Line 1:
{{task}}
The task is to reverse the order of all tokens in each of a number of strings and display the result; the order of characters within a token should not be modified.
: '''Example:''' “<tt>Hey you, Bub!</tt>” would be shown reversed as: “<tt>Bub! you, Hey</tt>”
Tokens are any non-space characters separated by spaces (formally, white-space); the visible punctuation forms part of the word within which it is located and should not be modified.
'''Display''' the strings in order (1<sup>st</sup>, 2<sup>nd</sup>, 3<sup>rd</sup>, ···), and one string per line. (You can consider the ten strings as ten lines, and the tokens as words.)▼
You may assume that there are no significant non-visible characters in the input. Multiple or superfluous spaces may be compressed into a single space.
Some strings have no tokens, so an empty string (or one just containing spaces) would be the result.
▲'''Display''' the strings in order (1<sup>st</sup>, 2<sup>nd</sup>, 3<sup>rd</sup>, ···), and one string per line.
(You can consider the ten strings as ten lines, and the tokens as words.)
;Input data
|