[Question]
  [
Given a list or delimited string, output a list or delimited string with the first character of each word one word later.
For this challenge, a "word" consists of only all printable ASCII characters, except the space, newline, and tab character.
For example, take the string "Good afternoon, World!" (space-delimited):
```
1. String
"Good afternoon, World!"
2. Get the first characters:
"[G]ood [a]fternoon, [W]orld!"
3. Move the characters over. The character at the end gets moved to the beginning.
"[W]ood [G]fternoon, [a]orld!"
4. Final string
"Wood Gfternoon, aorld!"
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest code wins!
**Test cases:**
```
Input -> output (space-delimited)
"Good afternoon, World!" -> "Wood Gfternoon, aorld!"
"This is a long sentence." -> "shis Ts i aong lentence."
"Programming Puzzles and Code Golf" -> Grogramming Puzzles Pnd aode Colf"
"Input -> output" -> "onput I> -utput"
"The quick brown fox jumped over the lazy dog." -> "dhe Tuick qrown box fumped jver ohe tazy log."
"good green grass grows." -> "good green grass grows."
```
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~7~~ 6 bytes
```
€ćÁ2ôJ
```
Explanation:
```
€ć      Extract head of each
  Á     Rotate to the right
    2ô  Split into pieces of length two
      J Join
```
[Try it online!](https://tio.run/nexus/05ab1e#@/@oac2R9sONRoe3eP3/H63unp@foq6joJ6YVpJalJefnwfihOcX5aQoqscCAA "05AB1E – TIO Nexus")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~11~~ ~~10~~ ~~9~~ 8 bytes
Takes advantage of Japt's index wrapping and negative indexing.
```
ËhUgEÉ g
```
[Try it online](https://ethproductions.github.io/japt/?v=1.4.5&code=y2hVZ0XJIGc=&input=WyJUaGlzIiwiaXMiLCJhIiwibG9uZyIsInNlbnRlbmNlLiJd)
---
## Explanation
```
        :Implicit input of array U (each element is an individual word).
Ë       :Map over the array.
h       :Replace the first character of the current element (word) ...
Ug      :  with the word in the array at index ...
EÉ      :    current index (E) -1's ...
g       :  first character.
        :Implicit output of array of modified words
```
[Answer]
# [Haskell](https://www.haskell.org/), 43 bytes
```
p%((a:b):r)=(p:b):a%r
_%e=e
(%)=<<head.last
```
[Try it online!](https://tio.run/nexus/haskell#FcZbCoAgEEDRf1cxDAkK0QKiWUlEjDg9wESmWr/lx@XcWqxzPAY/qidX2rBVs1ohMRs562maDuE4JL6fevGZgaDomR/oYPubUSViDxjSK81dRTIu9QM "Haskell – TIO Nexus") Uses a list of strings for input and output.
Remembers the first letter of the previous word `p`, and recursively makes it the first letter of the current word while sending the new first letter down the chain. The previous first letter is initialized as the first letter of the last word.
[Answer]
# Ruby, ~~85~~ ~~77~~ 63 bytes
Pretty sure this could be much shorter.
Edit: Thanks for @manatwork for collect -> map
```
a=gets.split;$><<a.zip(a.rotate -1).map{|x,y|y[0]+x[1..-1]}*' '
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 bytes
```
Ḣ€ṙ-;"
```
[Try it online!](https://tio.run/nexus/jelly#@/9wx6JHTWse7pypa630/3D70UkPd874/z9a3dFJXUfd2QVIuLqpxwIA "Jelly – TIO Nexus")
Thanks to [Dennis](https://codegolf.stackexchange.com/users/12012/dennis) for reading the rules better than me, this returns a list of the words. It doesn't work as a full program.
[Answer]
# [CJam](https://sourceforge.net/p/cjam), ~~12~~ ~~10~~ 9 bytes
Saved 1 byte thanks to jimmy23013
```
q~Sf+:()o
```
Takes input as a list of words.
[Try it online!](https://tio.run/nexus/cjam#@19YF5ymbaWhmf//f7SSe35@ipKCUmJaSWpRXn5@ng6QE55flJOiqBQLAA "CJam – TIO Nexus")
### Explanation
```
     e# Example input: ["Good" "afternoon," "World!"]
q~   e# Read and eval the input.
     e# STACK: [["Good" "afternoon," "World!"]]
Sf+  e# Append a space to each word.
     e# STACK: [["Good " "afternoon, " "World! "]]
:(   e# Remove the first character from each substring.
     e# STACK: [["ood " 'G "fternoon, " 'a "orld! " 'W]]
)o   e# Remove and print the last element of the array.
     e# STACK: [["ood " 'G "fternoon, " 'a "orld! "]]
     e# Implicitly join the remaining array with no separator and output.
```
[Answer]
## JavaScript (ES6), 46 bytes
```
s=>s.map((k,i)=>s.slice(i-1)[0][0]+k.slice(1))
```
Takes advantage of the fact that `slice(-1)` returns the last element of an array.
**Snippet**
```
f =
s=>s.map((k,i)=>s.slice(i-1)[0][0]+k.slice(1))
console.log(f(['Good', 'afternoon,', 'World!']));
console.log(f(['This', 'is', 'a', 'long', 'sentence.']));
console.log(f(['Programming', 'Puzzles', 'and', 'Code', 'Golf']));
console.log(f(['Input', '->', 'output']));
console.log(f(['The', 'quick', 'brown', 'fox', 'jumped', 'over', 'the', 'lazy', 'dog.']));
console.log(f(['good', 'green', 'grass', 'grows.']));
```
[Answer]
# [V](https://github.com/DJMcMayhem/V), 7 bytes
```
Îxjp
{P
```
[Try it online!](https://tio.run/nexus/v#@3@4ryKrgKs64P//gKL89KLE3NzMvHSugNKqqpzUYq7EvBQu5/yUVC73/Jw0AA "V – TIO Nexus")
Explanation:
```
Î       " On every line:
 x      "   Delete the first character
  j     "   Move down a line
   p    "   And paste a character (into column 2)
{       " Move to the beginning of the input
 P      " And paste the last thing we deleted (into column 1)
```
[Answer]
# Vim, ~~16~~, 9 bytes
```
<C-v>GdjPGD{P
```
*7 bytes saved thanks to @Wossname!*
Takes input one word per line, e.g.
```
Hello
world
and
good
day
to
you
```
I believe this should be fine since taking the input as a list is allowed.
[Try it online!](https://tio.run/nexus/v#@y/mnpIV4O5SHfD/f0BRfnpRYm5uZl46V0BpVVVOajFXYl4Kl3N@SiqXe35OGgA)
[Answer]
# [><>](https://esolangs.org/wiki/Fish), ~~44~~ 45 bytes
```
90.f3+0.>&i&01.>~r&l0=?;o20.
 i:" "=?^:1+ ?!^
```
Assumes space-separated words.
Correction by Aaron added 1 byte
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 6 bytes
Takes matrix with one word per column.
```
¯1∘⌽@1
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///37M8seBR24RD6w0fdcx41LPXwRAipvCobypQ/FHbxGgDPdNYdff8/BR1BfXEtJLUorz8/DwdICc8vygnRVEdAA "APL (Dyalog Unicode) – Try It Online")
`¯1∘⌽` rotate one step right
`@` at
`1` row 1
[Answer]
## Python 2, 74 bytes
[Try it online](https://tio.run/nexus/python2#DcixCoAgEADQva@4JpVMag2a@wCHBnFQKriIOzFb@nlrevCqnZHSU6Qyd7rwt0kZqQgQ5mQkGd3gu@DGyR@cIegISPBiklZb1//dWTf1o1eqVrEwbxCOsmdiJg0r52trxQc)
```
S=input().split()
print' '.join(b[0]+a[1:]for a,b in zip(S,S[-1:]+S[:-1]))
```
-5 bytes, thanks to @Rod
[Answer]
# [Haskell](https://haskell.org), 50 bytes
```
f=zipWith(:).((:).last<*>init).map head<*>map tail
```
Input and output are as lists of words.
[Answer]
# PHP, 62 bytes
```
$c=end($_GET);foreach($_GET as$g)echo$g|$g[0]=$c^$g^$c=$g,' ';
```
[Answer]
# C#, ~~78~~ 77 bytes
```
using System.Linq;a=>a.Select((s,i)=>a[i-->0?i:a.Count-1][0]+s.Substring(1));
```
Compiles to a `Func<List<string>, IEnumerable<string>>`, Full/Formatted version:
```
using System;
using System.Collections.Generic;
using System.Linq;
class P
{
    static void Main()
    {
        Func<List<string>, IEnumerable<string>> f = a =>
                a.Select((s, i) => a[i-- > 0 ? i : a.Count - 1][0] + s.Substring(1));
        Console.WriteLine(string.Join(" ", f(new List<string>() { "Good", "afternoon,", "World!" })));
        Console.WriteLine(string.Join(" ", f(new List<string>() { "This", "is", "a", "long", "sentence." })));
        Console.ReadLine();
    }
}
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 12 bytes
```
{hᵐ↻|bᵐ}ᶠzcᵐ
```
[Try it online!](https://tio.run/nexus/brachylog2#@1@d8XDrhEdtu2uSgHTtw20LqpKBjP//o5Xc8/NTlHSUEtNKUovy8vPzdICc8PyinBRFpdj/UQA "Brachylog – TIO Nexus")
### Explanation
```
Example input: ["Good","afternoon,","World!"]
{      }ᶠ       Find: [["W","G","a"],["ood","fternoon,","orld!"]]
 hᵐ↻              Take the head of each string, cyclically permute them
    |             (and)
     bᵐ           Get the strings without their heads
         z      Zip: [["W","ood"],["G","fternoon,"],["a","orld!"]]
          cᵐ    Map concatenate on each list: ["Wood","Gfternoon,","aorld!"]
```
[Answer]
# R, ~~72~~ 70 bytes
`function(x)paste0(substr(x,1,1)[c(y<-length(x),2:y-1)],substring(x,2))`
[Try it online](https://tio.run/##Jco7CsMwDADQq7SeJFCgzhjaOUfoUDrkY6cGIwVbgeT0rkPGBy@V4l9@40mDMOy4DlndA/I2Zk2wkyWLnwmOZxMdL/qrhdruaCx@6UqBl/paxOIhhqxgepHZ0M0MXl1iEaZTb0lxvpv6yh8)
2 bytes saved thanks to Giuseppe.
Input and output are lists. Takes a substring consisting of the first letters, cycles the last one to the front, and pastes it together with a substring of the rest of each word. The cycling step is a killer, but I can't figure out a way to cut it down any further.
[Answer]
## Python 2 + Numpy, 104 bytes
```
from numpy import *
s=fromstring(input(),"b")
m=roll(s==32,1)
m[0]=1
s[m]=roll(s[m],1)
print s.tobytes()
```
[Answer]
# [Fig](https://github.com/Seggan/Fig), \$13\log\_{256}(96)\approx\$ 10.701 bytes
```
j/ +e[qJ]xxep
```
*-2.469 bytes thanks to one of the @Sʨɠɠans*
[Try it online!](https://fig.fly.dev/#WyJqLyArZVtxSl14eGVwIiwiW1N3YXAsIHRoZSwgZmlyc3QsIGxldHRlcnNdIl0=)
Explanation:
```
       J       # Append
          x    # the input
        ]x     # to the first item from the input,
      q        # then remove the first item from that.
    e[         # Get the first character from each item.
           ep  # Get the input with the first char of each word removed.
   +           # Add,
j              # join by
 /             # space
```
[Answer]
## Mathematica, 59 bytes
```
""<>#&/@Thread@{RotateRight@#~StringTake~1,#~StringDrop~1}&
```
[Try it online!](https://sandbox.open.wolframcloud.com/)
Takes and returns a list of words.
If you prefer to take and return strings, this works for 87 bytes:
```
StringRiffle[Thread@{RotateRight@#~StringTake~1,#~StringDrop~1}&@StringSplit@#," ",""]&
```
[Answer]
# kdb+, ~~25~~ 22 bytes
**Solution:**
```
rotate[-1;1#'a],'1_'a:
```
**Example:**
```
q)rotate[-1;1#'a],'1_'a:("The";"quick";"brown";"fox";"jumped";"over";"the";"lazy";"dog.")
"dhe"
"Tuick"
"qrown"
"box"
"fumped"
"jver"
"ohe"
"tazy"
"log."
```
**Explanation:**
```
1_'a:             // (y) drop first character of each element of a
,'                // join each left with each right
rotate[-1;1#'a]   // (x) take first character of each element of a, rotate backwards 1 char
```
**Extra:**
A version that takes a regular string (37 bytes):
```
q){" "sv rotate[-1;1#'a],'1_'a:" "vs x}"The quick brown fox jumped over the lazy dog."
"dhe Tuick qrown box fumped jver ohe tazy log."
```
[Answer]
# [Perl 5](https://www.perl.org/), 40 bytes
39 bytes of code + 1 for `-a`
```
$F[-1]=~/./;$a=$&,s/./$a/ for@F;say"@F"
```
[Try it online!](https://tio.run/##K0gtyjH9/1/FLVrXMNa2Tl9P31ol0VZFTacYyFRJ1FdIyy9ycLMuTqxUcnBT@v/fPT8/RSExrSS1KC8/P09HITy/KCdF8V9@QUlmfl7xf11fUz0DQ4P/uokA "Perl 5 – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 34 bytes
```
;@(,.~_1|.])~/@|:@(split;.2)@,&' '
```
[Try it online!](https://tio.run/##FU7NSgMxGLzvU4wXt4VtRI8WS6BgETz0IHgSiZsvaWo235ofq0vpq68RhmGYGYY5zrN5EFjLRScu77dn8ba83MjzvVyk0bu8FndL2V23aGfqDyyN3KAv@fkRKWsX0LbzjllDmUwxMIcOrxy9vmpeDi6hQsFzsEgUMoWeRLOPbKMaBlfdfZkmT7UUNLasCTv2pnkKY8lYbcAlV1WnCF/F9Z/4iHwKMPyDYxlG0uBvisg192r6hWYrGvv/x0aiUFmlVJlPSfwB "J – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 11 bytes
```
Foz:ṙ_1TmΓ,
```
Input and output as a list of strings, [try it online!](https://tio.run/##yygtzv5f/qipsfy/W36V1cOdM@MNQ3LPTdb5//9/SEaqQmFpZnK2QlJRfnmeQlp@hUJWaW5BaopCfllqkUIJUD4nsapSISU/XQ8A "Husk – Try It Online")
(The header just transforms the input to a list of words and joins the output list with spaces.)
### Explanation
```
F(z:ṙ_1)TmΓ,  -- example input: ["Good" "afternoon,","World!"]
         m    -- map the following (example on "Good")
          Γ   -- | pattern match head & tail: 'G' "ood"
           ,  -- | construct tuple: ('G',"ood")
              -- : [('G',"ood"),('a',"fternoon,"),('W',"orld!")]
        T     -- unzip: ("GaW",["ood","fternoon,","orld!"])
F(     )      -- apply the function to the pair
    ṙ_1       -- | rotate first argument by 1 (to right): "WGa"
  z:          -- | zip the two by (example with 'W' and "ood")
              -- | | cons/(re)construct string: "Wood"
              -- :-: ["Wood","Gfternoon,","aorld!"]
```
### Alternative, 11 bytes
```
§oz:ṙ_1m←mt
```
[Try it online!](https://tio.run/##yygtzv5f/qipsfz/oeX5VVYPd86MN8x91DYht@T///8hGakKhaWZydkKSUX55XkKafkVClmluQWpKQr5ZalFCiVA@ZzEqkqFlPx0PQA "Husk – Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), ~~46~~ ~~37~~ 31 bytes
*Several bytes saved thanks to @Neil and @PunPun1000*
```
(\S)(\S* +)
$2$1
(.* .)(.)
$2$1
```
[Try it online!](https://tio.run/##JU7LasNADLzvV0wgATttFtIPyKUH01ughV566CYrb9yupXQfTeKfdxUKo2E0GsQkKgO77bxqus@5@XhtddZ4aM3yabk1jV3Dto39X@e5E/FwfaHEIvyId0nRL8zbachQOEThgExciI9kzT5JSG4cB3X3dZoiaYg9nsUTOom9eeFzLdjsILWo0leEnzocv3FIcmH0csVXHc/kIb@UUPQe3XSDl2BNuPcJiYiVXc7Kcsn2Dw "Retina – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `S`, 7 bytes
```
vhǔ?vḢ+
```
[Try it online!](https://vyxal.pythonanywhere.com/#WyJTIiwiIiwidmjHlD924biiKyIsIiIsIltcIlN3YXBcIiwgXCJ0aGVcIiwgXCJmaXJzdFwiLCBcIkxldHRlcnNcIl0iXQ==)
```
vh       # Get the first item of each
  ǔ      # Rotate to the right
   ?     # Push the input
    vḢ   # Get the all but the first char of each
      +  # Add
```
[Answer]
## [Retina](https://github.com/m-ender/retina), ~~25~~ 20 bytes
Byte count assumes ISO 8859-1 encoding.
```
Om$`^.((?=.*¶))?
$#1
```
[Try it online!](https://tio.run/nexus/retina#FU5LagJBFNz3KSpoYNSkIQeILrIQVwoRshGxY7/pjPa8p/3xMwfzALnYpANFUVQVRT1Xn7tNnPTLdrjb6qqavevx72M0mqnh4K3fsEI/F7EwdaLAIvyCLwnePqn1TxNRYOCFHSJxIt6TVqsgLpi2bYq7yl3nqZTY4kMsYS6@Vgs@5YTXKSSnosoU4Zyb/RHfQa6MWm445PZEFnKhgFRyb7o7rDit3P8fF4i4sImxsFyj/gM "Retina – TIO Nexus")
Input and output are linefeed-separated. The test suite performs the necessary I/O conversion from space-separation.
[Answer]
## Mathematica, 134 bytes
```
(w=Characters@StringSplit@#;d=Drop[w,0,1];StringRiffle[StringJoin/@Table[PrependTo[d[[i]],RotateRight[First/@w][[i]]],{i,Length@w}]])&
```
[Answer]
# Pyth, 12 bytes
```
.b+hNtY.>Q1Q
```
Takes a list of words and returns a list of words.
[Try it!](https://pyth.herokuapp.com/?code=.b%2BhNtY.%3EQ1Q&input=%5B%27Good%27%2C+%27afternoon%2C%27%2C+%27World%21%27%5D&debug=0)
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), 97 bytes
```
for(int n=s.length,i=0,j=n-1;i<n;j%=n)System.out.print(s[j++].charAt(0)+s[i++].substring(1)+" ");
```
[Try it online!](https://tio.run/##LY6xDoJAEER7v2I1MbkLSLBGCisrKwsLQnEC6p24S24XEkP49hOM00zyJjMZZwazo65BV79C199aW0HVGmY4G4swrmDWn7MYmW0gW8N7TtVFvMVHUQJrGMOdvLIogDknbYMPecY2T2OX426f2QNmbpujvnxYmndCvSTd3BbFhYuiMqmexh9FpTriwi6A@xv/9tVeRxvY6CwsX6bVFMKJqA7mLo1HIozDlXxbr78 "Java (OpenJDK 8) – Try It Online")
]