Repeat every other character in string starting with second character
sed, 12
s/.(.)/&\1/g
Try it online!
brainfuck, 13 or 11 bytes
>,[.,[..,>]<]
Assumes EOF->0. :(
You can try it online!
(Assuming input also continues to give zeroes indefinitely after the first EOF, we can do it in 11 bytes:
,[.,[..>],]
though this eats memory.)
Jelly, 3 bytes
ḤÐe
A full program accepting a string which prints the result
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