[Question]
  [
**Requirements:**
* Take a single word as input with only lowercase alphabetical characters (a-z)
* Output a string where every other character is repeated, with the first repeated character being the second character in the string
**Example:**
Input: `abcde`
Output: `abbcdde`
**Winning Criteria:**  
Standard code golf. Shortest number of bytes in program wins.
**Clarification:**  
For languages with 1-based indexing the output must still match the above, `aabccdee` is **not** an acceptable solution.
  
[Answer]
# [sed](https://www.gnu.org/software/sed/), 12
```
s/.(.)/&\1/g
```
[Try it online!](https://tio.run/##K05N0U3PK/3/v1hfT0NPU18txlA//f//xKTklNR/@QUlmfl5xf91iwA "sed – Try It Online")
[Answer]
# brainfuck, 13 or 11 bytes
```
>,[.,[..,>]<]
```
Assumes EOF->0. :(
You can [try it online!](https://tio.run/##SypKzMxLK03O/v/fTidaD4j0dOxibWL//09MSk5JTQMA)
(Assuming input also continues to give zeroes indefinitely after the first EOF, we can do it in 11 bytes:
```
,[.,[..>],]
```
though this eats memory.)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ḤÐe
```
A full program accepting a string which prints the result
**[Try it online!](https://tio.run/##y0rNyan8///hjiWHJ6T@//9fPTEpOSVVHQA "Jelly – Try It Online")**
### How?
Utilises the fact that the implementation of the double atom, `Ḥ`, is multiplication by two, and that strings are lists of Python characters. In Python when a character is multiplied by two it becomes a Python string of length two (e.g. `'x'*2=='xx'`). Lastly the implicit output of a list composed entirely of characters and strings (or lists thereof) is its content all smashed together.
```
ḤÐe - Main Link: list of characters  e.g. input abcd -> ['a','b','c','d']
 Ðe - apply to even indices (1-indexed):
Ḥ   -   multiply by 2                     -> ['a', 'bb', 'c', 'dd']
    - implicit, smashing print            -> abbcdd
```
[Answer]
# [Python](https://docs.python.org/2/), 38 bytes
```
f=lambda s:s and s[:2]+s[1:2]+f(s[2:])
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P802JzE3KSVRodiqWCExL0WhONrKKFa7ONoQRKVpFEcbWcVq/k/LL1IoVsjMU4hWSlTSUUpMAhPJEDIFSqUqxVpxKRQUZeaVKAB1av4HAA "Python 2 – Try It Online")
Takes the first two characters, then the second character, then removes the first two characters and recurses.
---
**39 bytes**
```
f=lambda s,c=2:s and s[:c]+f(s[1:],3-c)
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P802JzE3KSVRoVgn2dbIqlghMS9FoTjaKjlWO02jONrQKlbHWDdZ839afpFCsUJmnkK0UqKSjlJiEphIhpApUCpVKdaKS6GgKDOvRAGoW/M/AA "Python 2 – Try It Online")
Flips between taking the first two or first one character.
[Answer]
# x86-16 machine code, IBM PC DOS, ~~14~~ 12 bytes
**Binary:**
```
00000000: b401 cd21 f7d9 78f8 cd29 ebf4            ...!..x..)..
```
**Unassembled:**
```
    START: 
B4 01   MOV  AH, 1      ; DOS read char from STDIN 
CD 21   INT  21H        ; put char in AL 
F7 D9   NEG  CX         ; toggle CX sign
78 F8   JS   START      ; if negative, loop to next char 
CD 29   INT  29H        ; DOS write char to screen again 
EB F1   JMP  START      ; loop until break/^C
```
A standalone executable DOS program. Input via `STDIN` (pipe or keyboard interactive), output to `STDOUT`.
Output:
[![enter image description here](https://i.stack.imgur.com/377EG.png)](https://i.stack.imgur.com/377EG.png)
[Answer]
# [Python 2](https://docs.python.org/2/), 34 bytes (xnor's improvement)
```
lambda s:`[c*11for c in s]`[7::10]
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUaHYKiE6WcvQMC2/SCFZITNPoTg2IdrcysrQIPZ/QVFmXolGmoZ6YlJySqq6puZ/AA "Python 2 – Try It Online")
# [Python 2](https://docs.python.org/2/), 36 bytes
```
lambda s:`sum(zip(s,s,s),())`[7::10]
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUaHYKqG4NFejKrNAo1gHCDV1NDQ1E6LNrawMDWL/FxRl5pVopGmoJyYlp6Sqa2r@BwA "Python 2 – Try It Online")
Slices characters 7, 17, 27… out of a string like this:
```
('a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c', 'd', 'd', 'd', 'e', 'e', 'e')
012345678901234567890123456789012345678901234567890123456789012345678901234
       ^         ^         ^         ^         ^         ^         ^
→ abbcdde
```
xnor's `c*11` trick achieves the same thing, but with a string like:
```
['aaaaaaaaaaa', 'bbbbbbbbbbb', 'ccccccccccc', 'ddddddddddd', 'eeeeeeeeeee']
012345678901234567890123456789012345678901234567890123456789012345678901234
       ^         ^         ^         ^         ^         ^         ^
→ abbcdde
```
# [Python 3](https://docs.python.org/3/), 37 bytes
```
lambda s:''.join(c*3for c in s)[1::2]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUaHYSl1dLys/M08jWcs4Lb9IIVkhM0@hWDPa0MrKKPZ/QVFmXolGmoZ6YlJySqq6puZ/AA "Python 3 – Try It Online")
If returning a tuple of characters is OK (which it isn't), `lambda s:sum(zip(s,s,s),())[1::2]` is a 33-byte solution.
[Answer]
# [J](http://jsoftware.com/), 8 bytes
```
#~1 2$~#
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/lesMFYxU6pT/a3KlJmfkK6gnJiUlp6SkqivoWimkgbjJQM5/AA "J – Try It Online")
* `1 2$~#` Shape `$~` the list `1 2` (repeating it cyclically as needed) until it matches the length `#` of the input.
* `#~` Use this `1 2 1 2...` "mask" to Copy `#~` the implicit input elementwise. That is, make 1 copy of the first char, 2 copies of the 2nd char, 1 copy of the third char, etc.
[Answer]
# [Haskell](https://www.haskell.org/), 24 bytes
```
f(a:b:t)=a:b:b:f t
f s=s
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P00j0SrJqkTTFkQlWaUplHClKRTbFv/PTczMU7BVyE0s8FUoKC0JLinyyVNQAfEV0hSilRKVdJQSk8BEMoRMgVKpSrH//yWn5SSmF//XTS4oAAA "Haskell – Try It Online")
[Answer]
# Haskell, ~~33~~ 24 bytes
By noticing that obviously `f [] = []` also fits the pattern `f s = s` and removing one extra space, we get to
```
f(a:b:s)=a:b:b:f s
f s=s
```
from my starting point of
```
f []=[]
f (a:b:s)=a:b:b:f s
f s=s
```
Now my answer matches xnor's Haskell answer.
You can [try it online!](https://tio.run/##y0gszk7Nyfn/P00j0SrJqljTFkQlWaUpFHMBsW3x/9zEzDwFW4WC0pLgkiKfPAUVheKM/HIglaaglJiUnKL0HwA).
[Answer]
# [Octave](https://www.gnu.org/software/octave/) / MATLAB, 16 bytes
```
@(s)s(1:2/3:end)
```
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en999Bo1izWMPQykjf2Co1L0Xzf5qGemJSckqquuZ/AA "Octave – Try It Online")
### Explanation
Non-integer values are [automatically rounded](https://stackoverflow.com/questions/40455299/does-matlab-accept-non-integer-indices) (with a warning) in colon index expressions.
[Answer]
# [CJam](https://sourceforge.net/p/cjam), ~~9~~ 8 bytes
```
q3e*1>2%
```
[Try it online!](https://tio.run/##S85KzP3/v9A4TavY0M5I9f//xKTklFQA "CJam – Try It Online")
## Explanation
```
  abcde             q     read input
→ aaabbbcccdddeee   3e*   repeat characters x3
→  aabbbcccdddeee   1>    drop first 
→  a b b c d d e    2%    every other char
```
Esolanging Fruit saved 1 byte: `3f*s` → `3e*`.
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-m`](https://codegolf.meta.stackexchange.com/a/14339/), 4 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
+pVu
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LW0&code=K3BWdQ&input=ImFiY2RlZmdoaWpsa2xtbm9wcXJzdHV2d3h5eiI)
```
+pVu     :Implicitly map each character U at 0-based index V in the implicit input string
+        :Append to U
 p       :U repeated
  Vu     :  V mod 2 times
         :Implicit output of resulting string
```
[Answer]
# Scratch 3.0, 25 blocks/179 bytes
[![Blocks](https://i.stack.imgur.com/dimH8.png)](https://i.stack.imgur.com/dimH8.png)
As SB Syntax:
```
define f(n
set[i v]to(1
set[o v]to(
repeat((length of(n))/(2
set[o v]to(join(o)(letter(i)of(n
change[i v]by(1
set[x v]to(letter(i)of(n
set[o v]to(join(o)(join(x)(x
change[i v]by(1
```
Oh boy, here I go Scratching again! This was quite an interesting one to solve, and I quite enjoyed it. Thanks for the challenge.
The output of the function is shown in the top left corner.
Finally, [Try it on~~line~~ Scratch!](https://scratch.mit.edu/projects/364315112/)
[Answer]
# [Unreadable](https://esolangs.org/wiki/Unreadable), 43 bytes
> 
> '"""""'"""'""""'"'""""""""""'"'"'""""""""""
> 
> 
> 
[Try it online!](https://tio.run/##K80rSk1MSUzKSf3/X10JBNShGEhABJRgHCTu//@JSckpqQA "Unreadable – Try It Online")
Displayed here in variable-width font, per the traditional tribute to the language name.
Exits with error after printing the correct output.
Explanation:
```
'"""""'"""      while(1)
'""""           do 2 things:
'"'""""""""""   print(read stdin)
'"'"'"""""""""" print(print(read stdin))
```
Uses the fact that `'"` both prints and returns its argument, which can thus be directly fed to a 2nd print command.
[Answer]
# [Python 3](https://docs.python.org/3/), ~~43 41~~ 39 bytes
-2 thanks to mypetition (`s[:1]*i` can be `s[:i]` if we swap our order of `i`s)
```
f=lambda s,i=2:s and s[:i]+f(s[1:],i^3)
```
A recursive function which accepts a string and returns a string.  
Works in Python 2 too.
**[Try it online!](https://tio.run/##K6gsycjPM/7/P802JzE3KSVRoVgn09bIqlghMS9FoTjaKjNWO02jONrQKlYnM85Y839BUWZeiUaahnpiUnJKalp6RmZWtrqm5n8A "Python 3 – Try It Online")**
At each call we return `s` if it is empty or take the first *up-to-i-characters* of the given string (`s[:i]`) where `i` starts out as `2` and append (`+`) the result of another call to the function this time using a new `s` of all but the first character (`s[1:]`) and a new `i` found by XOR-ing with three (`i^3`) - i.e. `2, 1, 2, 1, ...`
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), ~~5~~ 3 bytes
```
3•y
```
[Try it Online!](https://lyxal.pythonanywhere.com?flags=&code=3%E2%80%A2y&inputs=abcde&header=&footer=)
```
3•  # Repeat each character three times
  y # Get every other character
```
[Answer]
# Brainfuck, ~~52~~ 31 bytes
```
,[>>+<[<..>->-]>[<<.>+>->]<<<,]
```
You can [try it online](https://tio.run/##SypKzMxLK03O/l@jkJlXoFCjkFuaUwKkEksrgGRqXsp/nWg7O22baBs9PTtdO91Yu2gbGz07bSA71sbGRif2///EpOSU1DQA) or you can check my first submission, that I think is also simpler to understand:
```
+>+>>,[<<[-<->]<[->>+>>+<<<<]+>>>.>[-<.>]<,<[-<+>]>
```
Cell layout is
```
| 1 | aux | mult | inp | mult |
```
where mult is the number of extra times we have to print the current character. Feel free to drop me a line in the comments with feedback.
[Try it online!](https://tio.run/##LUpLCoAgFLyK@6dCe5mLiAu1BKkkIqGFd389oVnMP92xttLzzkMtaqjYX@GzH49IbdcfmECA9s554wyCCGZDThDEwEIWK4ueF0JAYI4pr1v5AA)
[Answer]
# [Shakespeare Programming Language](https://github.com/TryItOnline/spl), 126 bytes
```
,.Ajax,.Page,.Act I:.Scene I:.[Exeunt][Enter Page and Ajax]Ajax:Open mind.Speak thy.Open mind.Speak thy.Speak thy.Let usAct I.
```
[Try it online!](https://tio.run/##Ky7I@f9fR88xK7FCRy8gMT0VyE4uUfC00gtOTs1LBTGiXStSS/NKYqNd80pSixRAihQS81IUQHpiQYSVf0FqnkJuZl6KXnBBamK2QklGpR42MQTLJ7VEobQYbJPe//@JSckpqQA "Shakespeare Programming Language – Try It Online")
Page reads the input one character at a time, and alternately prints it once or twice. Exits with error after printing the correct output.
[Answer]
# k4, ~~17~~ 13 bytes
edit: make use of `&` (where operator) which for each index i of an int-list L give gives L[i] copies of i. eg `&2 1 3` -> `0 0 1 2 2 2`
```
{x@&(#x)#1 2}
```
```
{           } /lambda with implicit arg x
    (#x)      /count x
        #1 2  /takes #x items of 1 2 (eg 3#1 2 -> 1 2 1)
   &          /&1 2 1 -> 0 1 1 2 
 x@           /index x
```
[Answer]
# Python 3, ~~54~~ ~~50~~ 49 bytes
This looks incredibly long, I have no idea if something obvious is slipping under my nose... And already saved 5 bytes thanks to @Jonathan Allan! Check [his 43 byte Python 3 answer](https://codegolf.stackexchange.com/a/198720/75323)! but here it is:
```
lambda s:''.join(c+i%2*c for i,c in enumerate(s))
```
You can [try it online!](https://tio.run/##DchLCoAgEADQqwxCqBUtahNBN2njlyZyFLVFp7fe8qW3npGWNeXmYYej3Spoq6BsnE9XRBJmwG7uDfiYAUcDSODoCS6r6kSRsqWMVIUXTGljHfvnAw)
[Answer]
# [SNOBOL4 (CSNOBOL4)](http://www.snobol4.org/csnobol4/), 84 bytes
```
	S =INPUT
S	S LEN(1) . L LEN(1) . R REM . S	:F(O)
	O =O L R R :(S)
O	OUTPUT =O S
END
```
[Try it online!](https://tio.run/##K87LT8rPMfn/nzNYwdbTLyA0hCsYyPRx9dMw1FTQU/BBMIMUglx9gXQwp5Wbhr8mF6e/gq0/UAFQXMFKI1iTy5/TPzQEaAJIOJjL1c/l///EpOSUVAA "SNOBOL4 (CSNOBOL4) – Try It Online")
[Answer]
# [Keg](https://github.com/JonoCode9374/Keg) `-ir` `-lp`, 4 bytes
```
(,⑩,
```
[Try it online!](https://tio.run/##y05N//9fQ@fRxJU6//8nJiWnpP7XzSz6r5tTAAA "Keg – Try It Online")
# Explanation
```
     # (Implicitly) take an input from the console
(    # For every item in the input:
 ,   # Print the first character, popping the stack
  ⑩  # Print the top of the stack w/o poping
   , # Print with popping, effectively doubling the second character
```
[Answer]
# JavaScript (ES6), 28 bytes
Uses the same regex as [@DigitalTrauma](https://codegolf.stackexchange.com/a/198722/58563).
```
s=>s.replace(/.(.)/g,"$&$1")
```
[Try it online!](https://tio.run/##BcEBCoAgDADAv4jEBqX0APvL0imFOGnR99fdTR9pfq75bkMKW02m6dDw8OyUGWKAgLGtzi9@d2hZhkrn0KVBBUdnLuwQ7Qc "JavaScript (Node.js) – Try It Online")
---
# JavaScript (ES6), 32 bytes
A recursive version.
```
f=([a,b,...c])=>b?a+b+b+f(c):[a]
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/f8/zVYjOlEnSUdPTy85VtPWLsk@UTsJCNM0kjWtohNj/yfn5xXn56Tq5eSna6RpKCUmJaekKmlqcmERBwr/BwA "JavaScript (Node.js) – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 25 bytes
```
->s{s.gsub /.(.)/,'\0\1'}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1664ulgvvbg0SUFfT0NPU19HPcYgxlC99n9BaUmxQlq0UmJSckqqUux/AA "Ruby – Try It Online")
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 13 bytes
```
,[.<[>.>]>>,]
```
[Try it online!](https://tio.run/##SypKzMxLK03O/v9fJ1rPJtpOzy7Wzk4n9v//xKTklFQA "brainfuck – Try It Online")
Handles odd and even length strings correctly. This takes an input and prints it once before checking if the previous cell contains the previous character. If so, it prints again and moves three spaces ahead, otherwise it just moves one cell ahead, and then it gets the next character.
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~40~~ ~~38~~ 37 bytes
```
-join($args|% t*y|%{"$_"*(1+$i++%2)})
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/XzcrPzNPQyWxKL24RlWhRKuyRrVaSSVeSUvDUFslU1tb1UizVvP////qJanFJZl56eoA "PowerShell – Try It Online")
Takes input `$args`, transforms it `t`oCharArra`y`, pipes that into a loop. Each iteration, we repeat the character `"$_"` either 1 or 2 times based on a modulo-index. Those characters/strings are left on the pipeline, gathered up with a `-join` to turn it back into a single string, and output is implicit.
*-2 bytes thanks to Veskah.*  
*-1 byte thanks to mazzy.*
[Answer]
# [Ruby](https://www.ruby-lang.org/), 25 bytes
```
->s{s.scan(/(.(.?))/)*''}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1664ulivODkxT0NfQ09Dz15TU19TS1299n9BaUmxQlq0emJSckqqeux/AA "Ruby – Try It Online")
Same byte count as the other answer, different approach.
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 11 bytes
```
B X_%2+1MEa
```
[Try it online!](https://tio.run/##K8gs@P/fSSEiXtVI29DXNfH///@JSckpqWnpAA "Pip – Try It Online")
-2 from Dlosc.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~5~~ 4 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
€Ðιθ
```
I/O as a list of characters, which is [allowed by default](https://codegolf.meta.stackexchange.com/a/2216/52210).
~~I have the feeling 4 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) might be possible, but I'm unable to find it.~~  
It is possible, by porting [*@emanresuA*'s Vyxal answer](https://codegolf.stackexchange.com/a/236924/52210) (so make sure to upvote him/her as well).
[Try it online.](https://tio.run/##yy9OTMpM/f//UdOawxPO7Ty34///aKVEJR2lJCBOBuIUIE5VigUA)
**Explanation:**
```
      #  (example input = ["a","b","c","d","e"])
€Ð    # Triplicate each character (which remains a flattened list)
      #  → ["a","a","a","b","b","b","c","c","c","d","d","d","e","e","e"]
  ι   # Uninterleave this list into two parts
      #  → [["a","a","b","c","c","d","e","e"],["a","b","b","c","d","d","e"]]
   θ  # Pop and leave just the second part
      #  → ["a","b","b","c","d","d","e"]
      # (which is output implicitly as result)
```
[Answer]
# [Rockstar](https://codewithrockstar.com/), ~~95~~ 81 bytes
```
listen to S
cut S
Y's 1
O's ""
while S
let O be+roll S*Y
let Y be Y-1 or 2
say O
```
[Try it here](https://codewithrockstar.com/online) (Code will need to be pasted in)
]