[Question]
  [
Sona is in her house with her 10 year old daughter. She needs to go to school to bring back another child from school, as school is over at 2 pm. It's hot outside, so she wants to leave her younger child at home.
She gave a bunch of strings to her child to keep her busy while she is gone. She asked her to reverse the words in the string. There are lot of strings, so you need to help her daughter in solving this huge task. 
So, given a string that contains words separated by single space, reverse the words in the string. You can assume that no leading or trailing spaces are there. 
The string will only contain `[a-zA-z ]`, so you don't need to handle punctuation.
You will be given a string as an input, and you should output a string.
### Sample Test Cases:
```
Input:
Man bites dog 
Output: 
dog bites Man
Input:
The quick brown fox jumps over the lazy dog
Output:
dog lazy the over jumps fox brown quick The
Input:
Hello world
Output:
world Hello
```
### Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"). Shortest answer in bytes wins.
  
[Answer]
## [Retina](https://github.com/m-ender/retina), 7 bytes
```
O$^`\w+
```
[Try it online!](https://tio.run/nexus/retina#@@@vEpcQU679/79vYp5CUmZJarFCSn46AA "Retina – TIO Nexus")
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 (`^`).
[Answer]
## Haskell, 21 bytes
```
unwords.reverse.words
```
[Try it online!](https://tio.run/nexus/haskell#@59mW5pXnl@UUqxXlFqWWlScqgfm/c9NzMxTsFUoKMrMK1FQUUhTUPJNzFNIyixJLVZIyU9X@g8A "Haskell – TIO Nexus")
[Answer]
# [Python 3](https://docs.python.org/3/), 29 bytes
```
print(*input().split()[::-1])
```
[Try it online!](https://tio.run/nexus/python3#@19QlJlXoqGVmVdQWqKhqVdckJMJpKOtrHQNYzX///dNzFNIyixJLVZIyU8HAA "Python 3 – TIO Nexus")
[Answer]
# 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.
[Answer]
# 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>
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 6 bytes
```
ṇ₁↔~ṇ₁
```
[Try it online!](https://tio.run/nexus/brachylog2#@/9wZ/ujpsZHbVPqIKz//5V8E/MUkjJLUosVUvLTlf5HAQA "Brachylog – TIO Nexus")
### 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".
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
ḲṚK
```
[Try it online!](https://tio.run/nexus/jelly#@/9wx6aHO2d5////3zcxTyEpsyS1WCElPx0A "Jelly – TIO Nexus")
Explanation:
```
Ḳ     Splits the input at spaces
Ṛ     Reverses the array
K     Joins the array, using spaces
```
[Answer]
# 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!](https://tio.run/nexus/r#@5@cWKJRlFqmUZycmKeho66uqan53zcxTyEpsyS1WCElP/0/AA)
[Answer]
# C#, 58 bytes
```
using System.Linq;s=>string.Join(" ",s.Split().Reverse());
```
[Answer]
# C, ~~54~~ 48 bytes
**Using arguments as input, 48 bytes**
```
main(c,v)char**v;{while(--c)printf("%s ",v[c]);}
```
[*Try Online*](https://tio.run/nexus/c-gcc#@5@bmJmnkaxTppmckVikpVVmXV2ekZmTqqGrm6xZUJSZV5KmoaRarKCkUxadHKtpXfv////cxLz/qYklxf9T8tMB)
```
> ./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"); }
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 4 bytes
```
#Rðý
```
Note: Will only work for 2 or more words. +1 byte if this is not OK.
[Try it online!](https://tio.run/nexus/05ab1e#@68cdHjD4b3///sm5ikkZZakFiuk5KcDAA "05AB1E – TIO Nexus")
[Answer]
# [GNU Make](https://www.gnu.org/software/make/), 62 bytes
```
$(if $1,$(call $0,$(wordlist 2,$(words $1),$1)) $(word 1,$1),)
```
[Answer]
# [brainfuck](https://github.com/TryItOnline/tio-transpilers), 74 bytes
```
,[>++++[<-------->-],]<[>++++[->--------<]+>[[<]>[+>]<]<-[<]>[.>]<[[-]<]<]
```
[Try it online!](https://tio.run/nexus/brainfuck#@68TbacNBNE2ulBgpxurE2sDFQXyoMAmVtsuOtom1i5a2y7WJtZGF8zWA7Kjo3VBArH//7vkpyskZZakFivkJuYBAA "brainfuck – TIO Nexus")
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
]
```
[Answer]
# [Cubix](https://github.com/ETHproductions/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!](https://tio.run/nexus/cubix#@58fGm8dHG7tYO/oVGqnaVUSrGtvHWOgUhhXrKdibW2jUmOYXxyqqGFtraenZ6OsYfj/f0lRfmlSTqpCRqpCZjEA "Cubix – TIO Nexus")
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:
* Get all input `A` and reverse `B` stack
* Move the negative `q` to the bottom, add a counter `0` to the stack. bit of jumping around in here.
* Find space/end loop, also puts stack in correct print order.
	+ Increment counter `)` and fetch the counter item from the stack `t`
	+ Is it a space or EOI `S-?`
	+ Repeat if not
* Print word loop
	+ Decrement counter `(`
	+ Exit loop if counter `!U` is 0
	+ Swap `s` counter with character on stack
	+ Print `o` character and pop it from the stack `;`
	+ Repeat loop
* Get the length of the stack `#` and decrement `(`
* Check `?` if 0 and exit `@` if it is 0
* Otherwise print a space `So` clean up `;;` and go back to the first loop.
I've skipped a number of superfluous steps, but you can see it [Step By Step](https://ethproductions.github.io/cubix/?code=ICAgICAgbyBVIF8KICAgICAgOyBTIFcKICAgICAgOyBAID8KQSBCIHUgPiApIDogdCBTIC0gPyA7IFwKMCAkIHEgXiBzIC4gJCA7IDsgPCAkIHwKMSBvIHMgVSAhICggOyA7IC4gLiAuIDwKICAgICAgIyAoIDEKICAgICAgLiAuIC4KICAgICAgLiAuIC4K&input=aGVyZSB0aGV5IGFyZQ==&speed=10)
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~11~~ ~~10~~ ~~7~~ 4 bytes
My first attempt at Japt.
```
¸w ¸
```
[Try it online](http://ethproductions.github.io/japt/?v=1.4.4&code=uHcguA==&input=Ik1hbiBiaXRlcyBkb2ci)
* Saved 3 bytes thanks to [ETHproductions](https://codegolf.stackexchange.com/users/42545/ethproductions)
---
## Explanation
```
    :Implicit input of string U
¸   :Split on <space>
w   :Reverse
¸   :Join with <space>
```
---
Please share your Japt tips [here](https://codegolf.stackexchange.com/q/121253/58974).
[Answer]
# [Python 2](https://docs.python.org/2/), 34 bytes
```
lambda s:' '.join(s.split()[::-1])
```
[Try it online!](https://tio.run/nexus/python2#S7ON@Z@TmJuUkqhQbKWuoK6XlZ@Zp1GsV1yQk1mioRltZaVrGKv5v6AoM69EIU1D3TcxTyEpsyS1WCElP11d8z8A "Python 2 – TIO Nexus")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 4 bytes
```
jd_c
```
[Try it online!](http://pyth.herokuapp.com/?code=jd_c&input=%22Man%20bites%20dog%22&test_suite=1&test_suite_input=%22Man%20bites%20dog%22&debug=0)
[Answer]
# PHP, 47 Bytes
```
<?=join(" ",array_reverse(explode(" ",$argn)));
```
[Try it online!](https://tio.run/nexus/php#s7EvyCjgUkksSs@zVfJNzFNIyixJLVZIyU9Xsuayt/tvY2@blZ@Zp6GkoKSTWFSUWBlflFqWWlScqpFaUZCTn5IKlgHr19TUtP7/HwA "PHP – TIO Nexus")
[Answer]
# k, 9 bytes
```
" "/|" "\
```
[Try it in your browser of the web variety!](http://johnearnest.github.io/ok/?run=%22%20%22%2F%7C%22%20%22%5C%22Man%20bites%20dog%22)
```
     " "\ /split on spaces
    |     /reverse
" "/      /join with spaces
```
[Answer]
# [J-uby](http://github.com/cyoce/J-uby), 23 bytes
```
:split|:reverse|~:*&' '
```
### Explanation
```
:split   # split by spaces
|        # then
:reverse # reverse 
|        # then
~:*&' '  # join with spaces
```
[Answer]
## Mathematica, 35 bytes
```
StringRiffle@Reverse@StringSplit@#&
```
[Try it online!](https://tio.run/nexus/mathics#S7P9H1xSlJmXHpSZlpaT6hCUWpZaVJzqABEMLsjJLIlW1lFSUIpV@x8AFCpRcEhzUPJNzFNIyixJLVZIyU9X@g8A "Mathics – TIO Nexus")
[Answer]
# Vim, 20 bytes
```
:s/ /\r/g|g/^/m0<cr>vGJ
```
This is shorter than the other vim answer.
[Try it online!](https://tio.run/nexus/v#@29VrK@gH1Okn16Trh@nn2vAVebu9f@/b2KeQlJmSWqxQkp@OgA "V – TIO Nexus")
[Answer]
# [Röda](https://github.com/fergusq/roda), ~~27~~ 25 bytes
*2 bytes saved thanks to @fergusq*
```
{[[split()|reverse]&" "]}
```
[Try it online!](https://tio.run/nexus/roda#S4v5Xx0dXVyQk1mioVlTlFqWWlScGqumpKAUW/s/NzEzr5orWslRIclZIcU1TcE9wzNLKbYmjav2PwA "Röda – TIO Nexus")
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 */
```
[Answer]
# 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.
```
[Answer]
# [Zsh](https://www.zsh.org/), 13 bytes
```
echo ${(Oa)@}
```
[Try it online!](https://tio.run/##qyrO@J@moVn9PzU5I19BpVrDP1HTofZ/LVeaQkhGqkJhaWZytkJSUX55nkJafoVCVmluQbFCfllqkUIJUDonsapSISU//T8A "Zsh – Try It Online")
[Answer]
# [Ohm](https://github.com/MiningPotatoes/Ohm), 4 bytes
```
z]Qù
```
[Try it online!](https://tio.run/nexus/ohm#@18VG3h45///vol5CkmZJanFCin56QA "Ohm – TIO Nexus")
**Explanation**
```
z     Split the input on spaces.
 ]    Dump it onto the stack.
  Q   Reverse the stack.
   ù  Join the stack with spaces. Implicit output.
```
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 7 bytes
```
qS/W%S*
```
[Try it online!](https://tio.run/nexus/cjam#@18YrB@uGqz1/79vYp5CUmZJarFCSn46AA "CJam – TIO Nexus")
**Explanation**
```
q        e# Read input
 S/      e# Split on spaces
   W%    e# Reverse
     S*  e# Join with spaces
```
[Answer]
# [TAESGL](https://github.com/tomdevs/taesgl), 7 bytes
```
ĴS)Ř)ĴS
```
[**Interpreter**](https://tomdevs.github.io/TAESGL/v/1.3.1/index.html?code=XHUwMTM0UylcdTAxNTgpXHUwMTM0Uw==&input=Ik1hbiBiaXRlcyBkb2ci)
**Explanation**
```
 ĴS)Ř)ĴS
AĴS)        implicit input "A" split at " "
    Ř)      reversed
      ĴS    joined with " "
```
[Answer]
# [J](http://jsoftware.com/), 6 bytes
```
|.&.;:
```
[Try it online!](https://tio.run/nexus/j#HYyxCsIwFEX3fsXFwVqoQddGRRHFQRdxlzZ9bQIxD5tXuvjvtTocuAcuZ6bSBtsCKXKsUEwsFY73/HoeP2qudDFmSSLmd9lo9Vwj1bcyoHJCETW3@oAKBjWh0RfynjFw52utH5Y6gosIjLKK7HshePdyAg4QOwmFViy4QYmhcyIUcAqtd9EiUpjUUJokZCxjh8W756lApbH7hUaTZf8NMeMX "J – TIO Nexus") This is reverse (`|.`) under (`&.`) words (`;:`). That is, split sentence into words, reverse it, and join the sentence again.
[Answer]
# 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 
```
]