[Question]
  [
## Intro/Background
I was looking at "You Had One Job" pictures lately, and noticed an old favourite of mine:
[![SHCOOL](https://i.stack.imgur.com/P8PwA.jpg)](https://i.stack.imgur.com/P8PwA.jpg)
And I said to myself: "I need a program that can generate text like that".
So I devised a set of rules for character swapping and wrote a CGCC challenge!
## The Challenge
Given a single string as input, output a string with its inner characters swapped. This can be done by:
* Leaving the first letter as is
* Swapping each pair of characters thereafter
* Leaving the last letter as is. If the string is of an odd length (i.e. the length of the string mod 2 is 1), leave the last two letters as they are.
## Example Inputs/Outputs
```
School -> Shcool
Somebody -> Smobedoy
Character -> Cahartcer
CGCC -> CCGC
Stack Exchange! -> SatkcE cxahgne!
Never gonna give you up -> Nvereg noang vi eoy uup
```
Walkthrough on swapping
```
School (Length: 6)
S
 hc
   oo
     l
Shcool
Somebody (Length: 8)
S
 mo
   be
     do
       y
Smobedoy
Character (Length: 9)
C
 ah
   ar
     tc
       er
Cahartcer
Stack Exchange! (Length: 15)
S
 at
   kc
     E 
       cx
         ah
           gn
             e!
SatkcE cxahgne!
```
## Rules
* Input/output can be taken/given in any convenient format
* The input will not contain newlines
* Minimum input length is 4
* Input will only contain printable ASCII characters
## Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the answer with the lowest bytes wins.
*Sorry about the last test case everyone. It's fixed now*
  
[Answer]
# [Haskell](https://www.haskell.org/), 31 bytes
```
f(a:b:c:d:e)=a:c:f(b:d:e)
f x=x
```
[Try it online!](https://tio.run/##JYy7DgIhEEX7/YqRWKyJX0BCZSyttjTGDOwgZHkFKNCfR1y7c@5JrsGykXO96xm55IqvnE4CB@hZ7jJpaKL1SqUWcWeLMjE6dmZL9CTj@h54MZhRVcq/uaLa4NqUwfCiA3tMHm0QHtPtCSnbUOEIH5tgPxw8Cui/9S8 "Haskell – Try It Online")
Avoids having to special-case omitting the first character by having extracting it be part of the recursive definition.
[Answer]
## brainfuck, 28 bytes
```
,.,[>,>,[<.[-]<.>>>]<<[.>]>]
```
[Try it online!](https://tio.run/##SypKzMxLK03O/v9fR08n2k7HTifaRi9aN9ZGz87OLtbGJlrPLtYu9v//4JLE5GwF14rkjMS89FRFAA)
First, we print the first character. Then we read the second character and enter the main loop. (`,.,[`)
When entering the main loop, we expect the first character of a pair to be in the current cell, and we read the next two into the next two cells (`>,>,`). The tape then looks like this:
```
[pair1] [pair2] [nextpair1] [0]
                     ^
```
Then, if `nextpair1` exists, we know there's going to be at least one character after the current pair, so we can output the two characters in this current pair in reverse (`[<.[-]<.>>>]`) – the triple `>` at the end moves us to the location after `nextpair1` to break out of the loop. Otherwise, we're at the end of the string, so we go back to `pair1` (`<<`) and print as many characters as we received in order (`[.>]`).
The main loop will end here if this was the end of the string (`>]`). If not, recall that we ended at the `[0]` in the diagram above after the check to see if `nextpair1` existed. So the `<<[.>]` would have brought the pointer to `pair2` (which was cleared) instead of `pair1`, and then `>]` restarts the main loop, but with the cursor pointing at `nextpair1`, which is exactly what we want.
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 12 bytes
```
V`^.|..(?=.)
```
[Try it online!](https://tio.run/##K0otycxLNPyvquGe8D8sIU6vRk9Pw95WT/P//@DkjPz8HK7g/NzUpPyUSi7njMSixOSS1CKugABnd67gksTkbAXXiuSMxLz0VEUuv9Sy1CKF9Py8vESF9MyyVIXK/FKF0gIA "Retina – Try It Online") Link includes test cases. Explanation: `V` reverses each match. The first character is matched separately, then characters are matched in pairs as long as there is still one character left that is unreversed.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~8~~ 7 bytes
```
Ḣ,Ṫjṭ2/
```
[Try it online!](https://tio.run/##AXUAiv9qZWxsef//4biiLOG5qmrhua0yL/874oCcIC0@IOKAnTvDhwrhu7TDh@KCrFn//3NjaG9vbApzb21lYm9keQpjaGFyYWN0ZXIKQ0dDQwpTdGFjayBFeGNoYW5nZSEKTmV2ZXIgZ29ubmEgZ2l2ZSB5b3UgdXA "Jelly – Try It Online")
A full program taking a string as its argument and printing the swapped string. Thanks to @JonathanAllan for saving a byte!
## Explanation
```
Ḣ       | Head
 ,Ṫ     | Paired with tail
   j    | Join with:
    ṭ2/ | The remainder, pair wise reduced by tacking the left item in the pair to the end of the right
```
[Answer]
# [Python 2](https://docs.python.org/2/), 49 bytes
```
f=lambda s:s[3:]and s[:3:2]+f(s[1:5:2]+s[4:])or s
```
[Try it online!](https://tio.run/##FcixDoIwEIDh3ae4dILoIuhyiZNxdWFsGI7SUiL0mrYQePoKy58vv9@TZVflbF4TzV1PEDHKGltyPUSJNVbt1RRR3vF5MsoHtiUHiNkc3WB0IBplmSdxEw3PuuN@P/i2FEglHc6dSP3gsylLbtDH@OpVBxjYOYJhXDXsvMDiBV7Ah9GlwhRbWeY/ "Python 2 – Try It Online")
Based off my [Haskell answer](https://codegolf.stackexchange.com/a/197489/20260). I tried a more direct port using splatted input, but it was clunky:
**57 bytes**
```
f=lambda a,b,c,*d:d[1:]and a+c+f(b,*d)or a+b+c+''.join(d)
```
[Try it online!](https://tio.run/##Fci9DoIwFEDh3ae46UILjYmOJE7G1YXRONz@0Sr0kqYQePpat3O@5cie4rUUd5twVgYBpZJatqY3r0v/xmgAO905rqoJSvVU/aY5fyhEbkRxFXcIEdigPdHEJBtotorMUfPuMaHONv05o/7CY9ce42grPO1mE4wUI8IYNgsHrbAurD/BkkLM3PF2F6L8AA "Python 2 – Try It Online")
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), ~~27~~ 20 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
Anonymous tacit prefix function. Requires `⎕IO←0`.
```
⊢⊇⍨∘⍋≢⌊1+⍳∘≢+2×2|⍳∘≢
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/qG@qp/@jtgkG/x91LXrU1f6od8WjjhmPersfdS561NNlqP2odzNIoHORttHh6UY1cO7/NKCuR719EAO6mg@tN37UNhHICw5yBpIhHp7B/9MU1IOTM/Lzc9S5QMz83NSk/JRKMMc5I7EoMbkktQjCc3d2hqgpSUzOVnCtSM5IzEtPVQSL@aWWpRYppOfn5SUqpGeWpSpU5pcqlBaoAwA "APL (Dyalog Extended) – Try It Online")
Explanation and walk-through for `"Somebody"` and `"Character"`:
`⍳∘≢` the indices of the length; `[0,1,2,3,4,5,6,7]`, `[0,1,2,3,4,5,6,7,8]`
`2|` two-mod of that; `[0,1,0,1,0,1,0,1]`, `[0,1,0,1,0,1,0,1,0]`
`2×` twice that; `[0,2,0,2,0,2,0,2]`, `[0,2,0,2,0,2,0,2,0]`
`⍳∘≢+` add the indices of the length to that; `[0,3,2,5,4,7,6,9]`, `[0,3,2,5,4,7,6,9,8]`
`1+` increment that; `[1,4,3,6,5,8,7,10]`, `[1,4,3,6,5,8,7,10,9]`
`≢⌊` the minimum of the length and that; `[1,4,3,6,5,8,7,8]`, `[1,4,3,6,5,8,7,9,9]`
`⍋` the grade (the indices that would sort it) of that; `[0,2,1,4,3,6,5,7]`, `[0,2,1,4,3,6,5,7,8]`
`⊢⊇⍨∘` use that to reorder the string; `"Smobedoy"`, `"Cahartcer"`
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg) `-p`, 26 bytes
```
s:g[^.||)>..$||..]=$/.flip
```
[Try it online!](https://tio.run/##K0gtyjH7/7/YKj06Tq@mRtNOT0@lpkZPL9ZWRV8vLSez4P//4OSM/PwcruD83NSk/JRKLueMxKLE5JLUIq7gksTkbAXXiuSMxLz0VMV/@QUlmfl5xf91CwA "Perl 6 – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 42 bytes
```
f=->s{s[/(.)(.)(.)(.+)/]?$1+$3+f[$2+$4]:s}
```
[Try it online!](https://tio.run/##KypNqvz/P81W1664ujhaX0NPE4a0NfVj7VUMtVWMtdOiVYy0VUxirYpr/0crBSdn5OfnKOkoBefnpiblp1QCmc4ZiUWJySWpRSDhksTkbAXXiuSMxLz0VKCAX2pZapFCen5eXqJCemZZqkJlfqlCaYFSrF5uYkF1TUVNgUJadEVs7X8A "Ruby – Try It Online")
[Answer]
# [Brain-Flak](https://github.com/Flakheads/BrainHack), ~~48~~ 40 bytes
```
({}<{({}<({}<>)>)<>}<>{{({}<>)<>}{}}<>>)
```
[Try it online!](https://tio.run/##SypKzMzLSEzO/v9fo7rWphpEgLCdpp2mjR2Qrq6GcIGc6logw07z////SiGpxSUKwSVFmXnpikr/dR0B "Brain-Flak (BrainHack) – Try It Online")
This doesn't work for strings that contain null bytes (unless the null byte is the first byte of the string).
## Explanation
```
({}<...>) Store the first element for later
  {({}<({}<>)>)<>}... Move the stack over in twos (preserving the order of each pair moved)
    <>{...{}}<>
      {({}<>)<>} Move everything back in ones
```
The one complex part is the `<>{...{}}<>`. Since moving over in twos can pick up an extra zero from the bottom of the stack we need to removing when bringing things back. Conveniently our main loop will stop when it hits a zero, so when it hits a zero we destroy that zero and, if the next thing is not zero we try again.
This means we will only stop if there are two zeros in a row, which since the input cannot contain zeros, will only occur at the bottom of the stack. In the process we will get rid of any zeros that are present, which fixes our extra zero issue.
# Works for all inputs, ~~114~~ 112 bytes
```
({}<([](())){({}[()]<(()[{}])>)}({}{}<([]){{}({}<({}<>)>)<>([])}>{}<>){(<{}({}<{}>)>)}{}([]){{}({}<>)<>([])}<>>)
```
[Try it online!](https://tio.run/##TYsxCoBADAS/olZJ4Q9CwDdod1xxiqgIFmoX8vaY80Astpid3fFM27GmaTcDUYIQARBRHAJgJKcgGpFRvSoLFNF37GE3xLlUflGAihXNzi@/x7clZjSzZpivu@rvczuWurG2ewA "Brain-Flak (BrainHack) – Try It Online")
Nearly all of the code is devoted to making this work for even length inputs.
[Answer]
# [C++ (clang)](http://clang.llvm.org/), ~~117~~ ... ~~82~~ 80 bytes
```
#import<map>
#define f(s)for(int i=1;i<s.size()-2;)s[i++]^=s[i++]^=s[i+1]^=s[i];
```
[Try it online!](https://tio.run/##TU/LbsIwELznK7ZGQnYpqPSYOPRQ9doLx5ZKxtkEq8S2/KCliG@njqMifPCuxzOzs9LaudwL3V0uE9Vb4wLvhV0VkwZbpRFa6llrHFU6gKqXleJ@4dUvUjZ/qph/V7PZ5rO@rcuxbqpkqOU@Ngj8gDIYl1yviDI@OBT9qhice6E0ZXAqIB0fmrIcFTz3ial0t4KAPnio4UTWcmfMnjyQtelxa5pjal92wgkZ0A1wEPILXn/kLm2GCXjDAzrojNYCOnVAOJoI0d7KYP0trE2DyLnKOdLaQEUMZponQzkG@I@ZKXSA2PWd40oTA3AOdJpldzVM77NyscUu7/kM5EOTZEgIG5jD7zjznG@HIToNj1VxvvwB "C++ (clang) – Try It Online")
Saved 11 bytes thanks to @AZTECCO!!!  
Saved 2 bytes thanks to @ceilingcat!!!
[Answer]
# [Python 3](https://docs.python.org/3/), 62 bytes
```
lambda x:x[0]+re.sub("(.)(.)",r"\2\1",x[1:-1])+x[-1]
import re
```
[Try it online!](https://tio.run/##FYixCoMwFAB3v@KRKUErtd2ETqVrF0d1iDEaqeaF1yjx69MUDu44d3qD9h6nRxdXuQ2jhFCH9trnpMvvPnDGS5FgBbHu1lWsCG1VX6pe5KFNypbNIXkgHSckCLBYYI0yiCsrWIObHnA8Uz6NJKm8pv/2Un3gFZSRdtZpvPWhCWa0VsK8HBpO3GF3rM7A0WI9n3gQIv4A "Python 3 – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 14 bytes
```
¦¨2ô€RJ¹θ¹н.ÁJ
```
[Try it online!](https://tio.run/##ATEAzv9vc2FiaWX//8Kmwqgyw7TigqxSSsK5zrjCudC9LsOBSv//U3RhY2sgRXhjaGFuZ2Uh "05AB1E – Try It Online")
```
¦¨2ô€RJ¹θ¹н.ÁJ
¦¨             # Delete the first and last letter
  2ô           # Break into groups of 2
    €R         # Reverse each of them
      J        # Join it back together
       ¹θ¹н    # Push the last and first letter of the input
           .Á  # Rotate stack, so the first letter is first
             J # Join the items in the stack
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 11 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
h1Ué ¤ò mÔq
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=aDFV6SCk8iBt1HE&input=IkNoYXJhY3RlciBTd2FwcGluZyI)
```
h1Ué ¤ò mÔq     :Implicit input of string U
h1              :Overwrite from the 1st (0-indexed) character on with
  Ué            :  Rotate U to the right
     ¤          :  Slice off the first 2 characters
      ò         :  Split into pairs
        m       :  Map
         Ô      :    Reverse
          q     :  Join
```
[Answer]
# [Ruby](https://www.ruby-lang.org/) -pl, 27 bytes
```
gsub /^.|..(?=.)/,&:reverse
```
[Try it online!](https://tio.run/##FcuxCgIxDADQvV@RSRS0twviIK4u3YW0hvbwbEraHhb8diO@/Un3QzXW7mG624@12/PJ7qb95ii0klRSdSExL8bxizw/hrkkFAyNxLiG4QnXd0iYI5nbf0DknBHivBIM7tCL@XJpM@eqh7L8AA "Ruby – Try It Online")
**Alternate solution with the same bytecount, but a regex nobody else has used yet:**
```
gsub /(^|.)(.(?=.))/,'\2\1'
```
[Try it online!](https://tio.run/##BcGxDsIgEADQ/b7itkKiNLobB@PahbUxAbxAY@UIhUYSv118L1fbevdbtTiKx1dJocT1oqQcD8N8nk9D79oF5hU0v8nys8EtmGxcoQy6GPfC@8cFEz3BRDtl9ByjQb/shI0r1gQ/TmXhuPVjWv8 "Ruby – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 40 bytes
```
f(a:b:c:d)=b:a:f(c:d)
f x=x
g(a:b)=a:f b
```
[Try it online!](https://tio.run/##JYy7CgIxFET7fMU1WOyCXxBIJZZW2onITTYvNi@yKVZ/PiZazZkzMBa3VXnfmp6QCSbZMnPBkOlpINGw852Ysc28WxCtqq1u/EHvI@mJ3qRNyQ9IQYm0vDueLRaUVZWhK8oVLru0GI060CcJ6CIPmK8vyMXFCkf4uAy/4859AfNv7Qs "Haskell – Try It Online")
xnor has [a shorter version of this answer](https://codegolf.stackexchange.com/a/197489/56656) that combines `f` and `g` into a single function.
[Answer]
# [J](http://jsoftware.com/), ~~24~~ 19 bytes
```
C.~[:}:_2<@|.\#\@}.
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/nfXqoq1qreKNbBxq9GKUYxxq9f5rcqUmZ@QrpCmoJyYlp6ij8FLRuGlIfGQpFGXqXP8B "J – Try It Online")
Creates the boxed indexes representing the cyclic form of the permutation we need (bookeeping), and then applies it `C.` to the input.
[Answer]
# [Gema](http://gema.sourceforge.net/), 15 characters
```
\A?=?
??\P?=$2?
```
The only interesting point here is the use of
> 
> `\P`       Position -- leave input stream here after the template matches
> 
> 
> 
Sample run:
```
bash-5.0$ echo -n 'School' | gema '\A?=?;??\P?=$2?'
Shcool
```
[Try it online!](https://tio.run/##S0/NTfz/P8bR3taey94@JsDeVsXI/v//4OSM/PwcAA "Gema – Try It Online") | [Try all test cases online!](https://tio.run/##lVDBbsIwDD2TrzBVR@CAkJB2mqoOVWjahU3jCNUUUtNWQFKlKaJi@/bOSSW2w3bYxXnxe7afvRN10WUoj8IgTBdgsbbvUtQYjdlgw9ey0PrI04ivC@mQT@oT7nTW@vRJ7zDTrSeSQhghLRrHJIJ@VtLHU09J4rME@iZWyAMsL7IQKseh7yXsQS5BXkSRK0o52QrPaCDXSgnIyzNCqxtoKidfEYM5KE0N4FwC6hYaotiEscqUyu6Bf8DddH5fwy/vnOJWceDPqmosvW9YN0cHlpcKaYuM4MuBM7bXBkonoghBeB3ejrR5TD@DB8g0GxhfHQXhGJCOBlMn9VUBTZvpys5yPIlZbaQHwLvtIo5iFsfb1zgK53HHYRIwNviH99uEIOznO3T9ttfT5BGcr83mhy6K/pKmKYxG/RJuf2cq0wq7Lw "Bash – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 40 bytes
```
f=s=>s[3]?s[0]+s[2]+f(s[1]+s.slice(3)):s
```
[Try it online!](https://tio.run/##fYvLDoIwEADvfgVyakMkKjcNejB@AceGw7qUtli7hG18fH3VqyHeJpmZAe7AOLkxrgJ1OqW@5vrAqmqPrNZtwWrbFr1gtflwyd6hFpWUO05Igcnr0pMRvcgZLZHPpdwvfkxDN32h7jXnThYmwKin2TECXrPzEy0Eo5d//6x5wDi6YL5VegM "JavaScript (Node.js) – Try It Online")
# [JavaScript (Node.js)](https://nodejs.org), ~~41~~ 40 bytes
-1 bytes thanks to Arnauld
```
s=>s.replace(/(?!^)(.)(.)(?=.)/g,"$2$1")
```
[Try it online!](https://tio.run/##fYvLCsIwEADvfkUbekhAU/QqtQfxC3oX1u02qY3ZkBQfXx/RoxRhbjNzhTskjGOYN557ykOTU3NIOlJwgCRr2ZZnJfWXttGqNmtR7aqtUBnZJ3akHRs5SJHQMjuh1H71Yzq@0YX715I7WoiAM8XFcQacitMTLXhD5d@/6B4QwujNp8pv "JavaScript (Node.js) – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), 57 bytes
```
def f(s):s[1:-2:2],s[2:-1:2]=s[2:-1:2],s[1:-2:2];return s
```
[Try it online!](https://tio.run/##PcmxDoMgFEDRvV/xwiI0OGg3mk5N1y6OpgPFh5BaIIBGv57axe3k3rBl492llAE1aJqYSH0j6la0L576VtTNrtshftxrxDxHB6loH2EF64B0yng/EU46/8W3H7addyOjVBnjP2epPvBYlZFuxD08ccEIo3dOwmgXhM3PMAciThCidZmeNZ1synRljCcMt6pi5Qc "Python 3 – Try It Online")
Accepts a list and returns a list.
The idea is to simply take the alternating slices and swap them.
Do let me know if the boilerplate stuff can be shortened in Python submissions.
[Answer]
# [C (clang)](http://clang.llvm.org/), ~~51~~ 48 bytes
```
f(char*s,z){*++s^=*s^=s[1]^=*++s;z>5&&f(s,z-2);}
```
[Try it online!](https://tio.run/##ddDPa8IwFAfwe/6KNw/S1AhLk46N4C4ydhvCjuIgy9Japon0h0zFv71LbGNlsEPg5Us@7yVRU7WRJm/bLFJrWcYVOeJTPJlUH7PYrWpJV65ye3F8TsfjLHIHpgkW57YwNWxlYSDCJwQeg1yuZqN3tbZ2MxIIdk1dRRK7KoskecDCB9AlQdALsVv9ab8OA6K9ouTxynwWWOLZ3JVS1boMzh1KepiQpw52UXDMu8Vi/jqMYr1ghAfBbgS/XLCW6hteflxkcn03YN5jTmgaNL/Rqddveq9LyK0xEvJir@FgG2h2Q5e075KShIUuPkOlrpvSwL1A57b7VxT@Cl1fj/x70J8ron@G/gI "C (clang) – Try It Online")
A recursive solution that modifies the original string
Saved 3 thanks to @ceilingcat suggestion to use `^=`
[Answer]
# x86-16 machine code, 13 bytes
Unassembled listing:
```
 46         INC  SI         ; skip first char 
 8B FE      MOV  DI, SI     ; point DI to string 
 D1 E9      SHR  CX, 1      ; divide counter by 2 with round down 
 49         DEC  CX         ; skip last char 
        CLOOP: 
 AD         LODSW           ; load next two chars 
 86 E0      XCHG AH, AL     ; reverse chars 
 AB         STOSW           ; store next two chars 
 E2 FA      LOOP CLOOP      ; keep looping
 C3         RET             ; return to caller
```
Input/output string in `[SI]`, length in `CX`.
**PC-DOS test program output:**
[![enter image description here](https://i.stack.imgur.com/IplqC.png)](https://i.stack.imgur.com/IplqC.png)
[Answer]
# [Burlesque](https://github.com/FMNSSun/Burlesque), 17 bytes
```
rt2cog_j)<-++.+RT
```
[Try it online!](https://tio.run/##SyotykktLixN/f@/qMQoOT89PkvTRldbW087KOT/f@eMxKLE5JLUIgA "Burlesque – Try It Online")
```
rt  # Rotate the string left
2co # Split into chunks of 2
g_j # Take pair of first and last out
)<- # Reverse each chunk
++.+# Join everything back together
RT  # Rotate the string right
```
For even length input only you can shave a single character:
```
RT2col_)<-++.+RT
```
[Answer]
# [Fortran (GFortran)](https://gcc.gnu.org/fortran/), 125 bytes
```
character(99)a,b(99)
read('(a)'),a
j=len_trim(a)
b=[a(1:1),(a(i+1:i+1),a(i:i),i=2,j-1,2),a(j:j)]
print*,(b(i)(1:1),i=1,j)
end
```
[Try it online!](https://tio.run/##JYtBCoMwEEX3OUV2nWnHRdwZ8Aq9QCll1GgntFGGKPT0qeLi8z6P/8dZs3KqpvEspfRvVu5zUGgaZOoOGA08wAUYL0hsYvsJ6ZVVvrsxXftgcN4hAYPcnN@zr0C8IElbU6wc1YeJPuLTLCopXwk6EDx/0jqKaEIaSrmHLaid5pTYTrIF@5tXuy5/ "Fortran (GFortran) – Try It Online")
Shame string manipulation in Fortran is so wordy as every substring needs two references. The main magic is mapping a to a character array via:
```
[a(1:1),            ! Prepend first char
(a(i+1:i+1),a(i:i), ! Swap a(i+1) for a(i)
  i=2,j-1,2)        ! For i in 2..n-1
,a(j:j)]            ! Append last char
```
[Answer]
# [J](http://jsoftware.com/), 48 bytes
Man, I love J
```
(1{.]),([:,[:(|."1)_2[\1}.]}.~_1-2|#),]{.~_1-2|#
```
[Try it online!](https://tio.run/##y/r/P83WSsOwWi9WU0cj2kon2kqjRk/JUDPeKDrGsFYvtlavLt5Q16hGWVMnthrG/p@anJGvkKag7pdallqkkJ6fl5eokJ5ZlqpQmV@qUFqg/h8A "J – Try It Online")
[Answer]
# [Zsh](https://www.zsh.org/), ~~74~~ 71 bytes
Found a more idiomatic `Zsh` solution. [Try it online!](https://tio.run/##LcpBC4IwGIDh@37F0h0UCpnHQiIk6NLJbrLDnN9cpE50MEv87WtG8B6ew/uZlJvA6MFgmA30NdRNqysko3hxNiP0NIzP3khMbEkZWWyZ7kloD5QlSRR2cXTeSsj98shvZcr@oGz17/F3rg6E0itCEhceut2gO6h0/fbMFR@5MDB6B4Xh4oWvs1C8b2AXIPcF)
```
w=$1;printf $w[1]${w[2,$#w-1]//(#m)(?)(?)/$MATCH[2]$MATCH[1]}${w:$#w-1}
```
[74 bytes:](https://tio.run/##qyrO@J@moVn9v9xWxdC6oCgzryRNQaU82jDWOi2/SCFTQaPaSE9PJVpFuVzXKFZPz6hWE6EoU9swFkTFWtvY2KhUl1upAEVq/9dycaUpBCdn5OfngBj5ualJ@SmVQKZzRmJRYnJJahGQrRRckpicreBakZyRmJeeqqjE9R8A "Zsh – Try It Online")
`w=$1;printf $w[1];for i ({2..$[$#w-2]..2})printf $w[i+1]$w[i];<<<${w:$i+1}`
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 20 bytes
```
§θ⁰Ｆ⪪✂θ¹±¹¦¦¦²⮌ι§θ±¹
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMOxxDMvJbVCo1BHwUBT05orLb9IQSO4ICezRCM4JzM5FSRhqKPgl5qeWJKqYaipqaNgpKmpANEclFqWWlScqpEJ0olhHkKPpvX//8ElicnZCq4VyRmJeempilz/dctyAA "Charcoal – Try It Online") Link is to verbose version of code. Works with strings of at least 2 characters. Explanation:
```
§θ⁰
```
Print the first character of the string.
```
Ｆ⪪✂θ¹±¹¦¦¦²
```
Split the inner slice of the string into 2-character substrings.
```
⮌ι
```
Print each substring reversed.
```
§θ±¹
```
Print the last character of the string.
[Answer]
# [SNOBOL4 (CSNOBOL4)](http://www.snobol4.org/csnobol4/), 104 bytes
```
 P =LEN(1)
 INPUT P . F REM . S
S S P . X P . Y REM . S
 F =F Y X
 GT(SIZE(S),2) :S(S)
O OUTPUT =F S
END
```
[Try it online!](https://tio.run/##K87LT8rPMfn/XyFAwdbH1U/DUJNLwdMvIDQEKKCn4KYQ5OoLpIO5ghWCwSIRYDISLg5UYusG5EdwKbiHaAR7RrlqBGvqGGkqWAUDGVz@Cv6hISDTgIqCuVz9XP7/d85ILEpMLkktAgA "SNOBOL4 (CSNOBOL4) – Try It Online")
[Answer]
# [Red](http://www.red-lang.org), ~~95~~ 76 bytes
```
func[s][prin take s t: take/last s
foreach[a b]s[prin any[b""]prin a]prin t]
```
[Try it online!](https://tio.run/##LY3BDoIwEETP9ivG/oB3r8R486DHpoelbCkBW9IWkK9HC@5l3kxespGb7cmN0sJeNzt5o5JWY@w8MvWMhHzd6TJQykjChshknCLUOh0i@VXVUuqjHJH19jexQImTfBkXwiALhTfXoVkLV44imcxxL/eq2oVMpsftYxz5ls9levDMEW3wntB2M2MNE6ZRCq0Efld@ZlgsQm9f "Red – Try It Online")
Directly prin(t)s the characters instead of returning a string.
[Answer]
# [Java (JDK)](http://jdk.java.net/), 43 bytes
```
s->s.replaceAll("(?<=.)(.)(.)(?=.)","$2$1")
```
[Try it online!](https://tio.run/##TY9Na8MwDIbv/RWaacEZqWE79pNRtp22S49jB9V1UreObWwlLIz@9ixfdAUbWXpeSa/PWOH8fLw0uvAuEJzbXJSkjchKK0k7Kx6XE2kwRvhAbeF3AuDLg9ESIiG1oXL6CEXL@J6CtvnXN2DIY9JLAd7GOauBpkPYQAbrJs43UQTlDUr1YgxnfLtai4QPZ9s@Wcqmz9MnljTLftptBalIEdbjEgC2lyfnDEtvuSvUwR3r/8ruhAElqXBXet/t7loI5QVef@QJba4e/sGnqlSA3FmLkOtKQe1KKD3r@XVwlrnAKwy9scVgL7m560Ck0PrNBHpvat4JkuWI93UkVQhXkvDt/yjjbBYXMIszy9J@Vtq1j/rrpLvX5g8 "Java (JDK) – Try It Online")
# Without much API, 60 bytes
```
s->{for(int i=1;i<s.length-2;)s[i]^=s[++i]^(s[i]=s[i++-1]);}
```
[Try it online!](https://tio.run/##TZBNa4NAEIbv@RVTIaA1LqTHGANFSk/tJUexsFlXs4nuyu5oK8HfblcjJodleeedj2fmQlsaXLLrIKpaaYSL1aRBUZK8kQyFkuQ1XLGSGgNfVEi4rQDq5lQKBgYp2q9VIoPKeu4RtZBFkgLVhfGmVIBYSdNUXO/ZmeokPUAO0WCCwy1X2hUSQUTbUOwNKbks8By8hZ5JRPoTmcT37e@Oygrh@8E29cJ@CKe@yzDkBg1E8zgA58jOSpXOZtGq4ieVdY9IbFEoQ66fQp9x/FSClF3h488yy4K/PIxv3nINhZKSQiFaDp1qoKmdye/vZONiLdUT2O6O5y109yvY22mLPHoE1YjzrjXtXC@c03JCGeM1ujZxCR47g7wiqkFS2@Uxd5212cHarKWzmZptQPLf@TRT6Vzbr8bXD/8 "Java (JDK) – Try It Online")
[Answer]
# [Keg](https://github.com/JonoCode9374/Keg), 16 bytes (SBCS)
The same program as below, with extra simplifying-ops added.
```
,(!½!2%¬-|$,,)(,
```
[Try it online!](https://tio.run/##y05N//9fR0Px0F5FI9VDa3RrVHR0NDV0/v8PTs7Iz8/5r5tZBAA "Keg – Try It Online")
# [Keg](https://github.com/JonoCode9374/Keg) `-ir`, 18 bytes
You know, Jono's challenges are *definitely* easily doable in Keg.
```
,(!2/1!2%--|$,,)(,
```
[Try it online!](https://tio.run/##y05N//9fR0PRSN9Q0UhVV7dGRUdHU0Pn///gksTkbAXXiuSMxLz0VMX/uplFAA "Keg – Try It Online")
## Explanation
```
                   # Take an input from STDIN
,                  # Step 1. Output the first item.
 (!2/              # Repeat half of the length-of-stack times
     1!2%--        # subtract by 1 if that's odd
           |$,,    # Swap & output the two items
               )(, # Output the remaining items
```
]