g | x | w | all
Bytes Lang Time Link
019Perl 5 a241107T211847ZXcali
008Uiua241107T205400Znyxbird
022AWK241107T200421Zxrs
013Zsh230709T101125Zroblogic
002Thunno 2 Ṡ230709T090331ZThe Thon
005MATL170518T001935ZSuever
003Vyxal210628T025148ZWasif
034GNU sed 4.2.2210627T014958ZMarco
029PowerShell Core210624T024532ZJulian
040Wren191218T142205Zuser8505
011tcl170628T165847Zsergiol
018tcl170628T152315Zsergiol
004Japt170518T071516ZShaggy
003Pyth170528T235117ZAAM111
025Röda170517T194328Zuser4180
028AWK170517T155358ZRobert B
020Vim170523T161946ZDJMcMayh
042Vim170518T102310ZHex
035Mathematica170518T003116ZZaMoC
023Juby170519T213422ZCyoce
042Lua170517T223229ZFelipe N
053Java 8170518T132910Zuser9023
048C170518T113756ZKhaled.K
057Clojurescript170519T023743Zmadstap
nan170519T001257ZBrad Gil
116Swift170518T153002ZCaleb Kl
024Ruby170518T104344Zmarmelad
062Java 8170518T081726ZKevin Cr
027jq170518T090723Zmanatwor
029Gema170518T090359Zmanatwor
037Scala170518T082850ZKevin Cr
026Cheddar170517T152252ZLeaky Nu
048Cubix170518T030639ZMickyT
074brainfuck170518T014915ZNitrodon
017Stacked170518T001317ZConor O&
006J170518T001022ZConor O&
009k170518T000943Zzgrep
nanRuby170517T225141ZValue In
006Brachylog170517T161536ZFatalize
021Bash + common Linux utilities170517T161517ZDigital
058C#170517T155157ZTheLetha
007TAESGL170517T150825ZTom
019R170517T153203ZGiuseppe
029Python 3170517T153004ZRod
062GNU Make170517T152648Zeush77
047PHP170517T152253ZJör
007CJam170517T150838ZBusiness
004Ohm170517T151654ZBusiness
021Haskell170517T150828Znimi
00405AB1E170517T150543ZOkx
004Pyth170517T150432Znotjagan
003Jelly170517T150327Zsteenber
031JavaScript ES6170517T150322ZShaggy
007Retina170517T150255ZMartin E
034Python 2170517T150219Ztotallyh

Perl 5 -a, 19 bytes

$,=$";say reverse@F

Try it online!

Uiua, 8 bytes

⍜⊜□⇌⊸≠@ 

Try it!

Note the trailing space.

⍜ under ⊜ partitioning into □ boxes ⊸ by ≠ inequality to @ space, ⇌ reverse.

AWK, -vRS=" " 22 bytes

{s=$1" "s}END{print s}

To test:

awk -vRS=" " '{s=$1" "s}END{print s}' <<< "The quick brown fox jumps over the lazy dog"

Zsh, 13 bytes

echo ${(Oa)@}

Try it online!

Thunno 2 , 2 bytes

Or

Try it online!

Explanation

    # Implicit input
O   # Split on spaces
 r  # Reverse
    # Join on spaces
    # Implicit output

MATL, 5 bytes

YbPZc

Try it at MATL Online!

Explanation

    % Implicitly grab input as a string
Yb  % Split it on all of the spaces, yielding a cell array of words
P   % Flip this array
Zc  % Join these words back together with spaces
    % Implicitly display the result

Vyxal, 3 bytes

⌈ṘṄ

Try it Online!

GNU sed 4.2.2, 34 bytes

Score includes +1 for -r passed to GNU sed.

:
s/(\w*) ([^:]*)/\2:\1/
t
y/:/ /

Try it online!

Another answer, 38 bytes:

s/^/:/
:
s/:(.*) (.*)/\2 :\1/
t
s/://

Try it online!

PowerShell Core, 45 29 bytes

$args|%{$r=,$_+$r}
$r-join' '

Try it online!

-16 bytes thanks to mazzy!

Wren, 40 bytes

Fn.new{|a|a.split(" ")[-1..0].join(" ")}

Try it online!

Explanation

Fn.new{|a|                             } // Anonymous function with the parameter a
          a.split(" ")                   // Split on spaces
                      [-1..0]            // Reverse the array
                             .join(" ")  // Join the array with spaces

tcl, 11

lreverse ""
          ^
          |
          Put the string you want to test here between the ""

Can be tested on http://www.tutorialspoint.com/execute_tcl_online.php starting the tcl interpreter by typing tclsh. Then type

lreverse "Man bites dog"

%

lreverse "The quick brown fox jumps over the lazy dog"

%

lreverse "Hello world"

tcl, 18

puts [lreverse $S]

demo

Japt, 11 10 7 4 bytes

My first attempt at Japt.

¸w ¸

Try it online


Explanation

    :Implicit input of string U
¸   :Split on <space>
w   :Reverse
¸   :Join with <space>

Please share your Japt tips here.

Pyth, 3 bytes

_cw

My first Pyth answer, one byte shorter than @notjagan's answer!

Explained:

 cw # Split the input by space (same as Python's string.split())
_   # Reverses the array
    # Pyth prints implicitly.

Röda, 27 25 bytes

2 bytes saved thanks to @fergusq

{[[split()|reverse]&" "]}

Try it online!

This function takes input from the input stream.

Explanation (outdated)

{[[(_/" ")()|reverse]&" "]}           /* Anonymous function */
   (_/" ")                            /* Pull a value from the stream and split it on spaces */
          ()                          /* Push all the values in the resulting array to the stream */
            |reverse                  /* And reverse it */
  [                 ]                 /* Wrap the result into an array*/
                     &" "             /* Concatenate each of the strings in the array with a space */
 [                       ]            /* And push this result to the output stream */

AWK, 30 28 bytes

{for(;++i<=NF;)s=$i" "s}$0=s

Try it online!

Thanks, manatwork, for catching my needless fluff. :)

Vim, 20 bytes

:s/ /\r/g|g/^/m0<cr>vGJ

This is shorter than the other vim answer.

Try it online!

Vim, 49 42 bytes

:s/.*/\=join(reverse(split(submatch(0))))/

Thank you to @manatwork for feedback

Mathematica, 35 bytes

StringRiffle@Reverse@StringSplit@#&

Try it online!

J-uby, 23 bytes

:split|:reverse|~:*&' '

Explanation

:split   # split by spaces
|        # then
:reverse # reverse 
|        # then
~:*&' '  # join with spaces

Lua, 66 42 bytes

for i=#...,1,-1 do
io.write(arg[i],' ')end

Try it online!

Java 8, 53 57 bytes

Lambda + Stream API

s->Stream.of(s.split(" ")).reduce("",(a,b)->b+" "+a)

Following Selim suggestion, we just dropped 4 bytes

C, 54 48 bytes

Using arguments as input, 48 bytes

main(c,v)char**v;{while(--c)printf("%s ",v[c]);}

Try Online

> ./a.out man bites dog

Using pointers, 84 bytes

f(char*s){char*t=s;while(*t)t++;while(t-s){while(*t>32)t--;*t=0;printf("%s ",t+1);}}

Use

main(){ f("man bites dog"); }

Clojure(script), 57 bytes

#(apply str(interpose" "(reverse(re-seq #"[a-zA-Z]+"%))))

Perl 6, 14 bytes

{~[R,] .words}

Try it

Expanded:

{              # lambda with implicit param $_

  ~            # stringify following (joins a list using spaces)

   [R,]        # reduce the following using the Reverse meta operator

        .words # call the words method on $_
}

Swift, 116 bytes

var r:(String)->String={return $0.characters.split(separator:" ").map(String.init).reversed().joined(separator:" ")}

You can try it here

Ruby, 27 24 bytes

thanks to @manatwork

->a{a.split.reverse*" "}

Java 8, 62 bytes

s->{String r="";for(String x:s.split(" "))r=x+" "+r;return r;}

Try it here.

Java 7, 77 bytes

String c(String s){String r="";for(String x:s.split(" "))r=x+" "+r;return r;}

Try it here.

jq, 27 characters

(23 characters code + 4 characters command line options)

./" "|reverse|join(" ")

Sample run:

bash-4.4$ jq -Rr './" "|reverse|join(" ")' <<< 'Man bites dog'
dog bites Man

On-line test

Gema, 29 characters

<W><s>=@set{o;$1 ${o;}}
\Z=$o

Sample run:

bash-4.4$ gema '<W><s>=@set{o;$1 ${o;}};\Z=$o' <<< 'Man bites dog'
dog bites Man 

Scala, 37 bytes

s=>s.split(" ").reverse.mkString(" ")

Try it here.

Cheddar, 26 bytes

3 bytes thanks to Conor O'Brien

@.split(" ").rev.join(" ")

Try it online!

Cubix, 48 bytes

Almost gave up on this one, but finally got there.

oU_;SW;@?ABu>):tS-?;\0$q^s.$;;<$|1osU!(;;...<#(1

Try it online!

This maps onto a cube with a side length of three as follows

      o U _
      ; S W
      ; @ ?
A B u > ) : t S - ? ; \
0 $ q ^ s . $ ; ; < $ |
1 o s U ! ( ; ; . . . <
      # ( 1
      . . .
      . . .

The general steps are:

I've skipped a number of superfluous steps, but you can see it Step By Step

brainfuck, 74 bytes

,[>++++[<-------->-],]<[>++++[->--------<]+>[[<]>[+>]<]<-[<]>[.>]<[[-]<]<]

Try it online!

This code creates the number -32 in two different places, but that seems to be fewer bytes than trying to maintain a single -32.

Explanation

,[                        input first character
  >++++[<-------->-]      subtract 32 from current character (so space becomes zero)
,]                        repeat for all characters in input
<                         go to last character of last word
[                         while there are more words to display:
 >++++[->--------<]       create -32 two cells right of last letter
 +>                       increment trailing space cell (1 right of last letter) so the next loop works
 [[<]>[+>]<]              add 32 to all cells in word and trailing space cell
 <-                       subtract the previously added 1 from the trailing space
 [<]>                     move pointer to beginning of word
 [.>]<                    output word (with trailing space)
 [[-]<]                   erase word
 <                        move to last character of previous word
]

Stacked, 17 bytes

' 'split rev' '#`

Try it online!

#` is "join".

J, 6 bytes

|.&.;:

Try it online! This is reverse (|.) under (&.) words (;:). That is, split sentence into words, reverse it, and join the sentence again.

k, 9 bytes

" "/|" "\

Try it in your browser of the web variety!

     " "\ /split on spaces
    |     /reverse
" "/      /join with spaces

Ruby, 23+1 = 24 bytes bytes

Uses the -p flag.

$_=$_.split.reverse*' '

Try it online!

Brachylog, 6 bytes

ṇ₁↔~ṇ₁

Try it online!

Explanation

ṇ₁        Split on spaces
  ↔       Reverse
   ~ṇ₁    Join with spaces

Note that both "split on spaces" and "join wth spaces" use the same built-in, that is ṇ₁, just used in different "directions".

Bash + common Linux utilities, 21

printf "$1 "|tac -s\ 

Leaves a trailing space in the output string - not sure if that's OK or not.

C#, 58 bytes

using System.Linq;s=>string.Join(" ",s.Split().Reverse());

TAESGL, 7 bytes

ĴS)Ř)ĴS

Interpreter

Explanation

 ĴS)Ř)ĴS
AĴS)        implicit input "A" split at " "
    Ř)      reversed
      ĴS    joined with " "

R, 19 bytes

cat(rev(scan(,'')))

reads the string from stdin. By default, scan reads tokens separated by spaces/newlines, so it reads the words in as a vector. rev reverses, and cat prints the elements with spaces.

Try it online!

Python 3, 29 bytes

print(*input().split()[::-1])

Try it online!

GNU Make, 62 bytes

$(if $1,$(call $0,$(wordlist 2,$(words $1),$1)) $(word 1,$1),)

PHP, 47 Bytes

<?=join(" ",array_reverse(explode(" ",$argn)));

Try it online!

CJam, 7 bytes

qS/W%S*

Try it online!

Explanation

q        e# Read input
 S/      e# Split on spaces
   W%    e# Reverse
     S*  e# Join with spaces

Ohm, 4 bytes

z]Qù

Try it online!

Explanation

z     Split the input on spaces.
 ]    Dump it onto the stack.
  Q   Reverse the stack.
   ù  Join the stack with spaces. Implicit output.

Haskell, 21 bytes

unwords.reverse.words

Try it online!

05AB1E, 4 bytes

#Rðý

Note: Will only work for 2 or more words. +1 byte if this is not OK.

Try it online!

Pyth, 4 bytes

jd_c

Try it online!

Jelly, 3 bytes

ḲṚK

Try it online!

Explanation:

Ḳ     Splits the input at spaces
Ṛ     Reverses the array
K     Joins the array, using spaces

JavaScript (ES6), 31 bytes

s=>s.split` `.reverse().join` `

Try it

f=
s=>s.split` `.reverse().join` `
o.innerText=f(i.value="Man bites dog")
oninput=_=>o.innerText=f(i.value)
<input id=i><pre id=o>

Retina, 7 bytes

O$^`\w+

Try it online!

Match all words (\w+) sort them with sort key empty string (O$) which means they won't get sorted at all, and then reverse their order (^).

Python 2, 34 bytes

lambda s:' '.join(s.split()[::-1])

Try it online!