- or download this
" one two three four "
- or download this
"four three two one"
- or download this
private static string reverseWords(string str) {
string[] words = Array.FindAll<string>(str.Split(
...
sb.Append(' ').Append(words[i]);
return sb.ToString();
}
- or download this
Array.Reverse(words);
return String.Join(" ", words);
- or download this
sub reverseWords {
join ' ', reverse split(' ', shift)
}
- or download this
sub reverseWords(Str $s) returns Str {
$s.words.reverse.join(' ')
}
- or download this
def reverseWords(s)
s.split.reverse.join(' ')
end
- or download this
reverseWords = unwords . reverse . words