Write a program to elasticize strings
Jelly, 3 bytes
Code:
ĖP€
Explanation:
Ė # Enumerate.
P€ # Product of each.
# Implicit joining of everything.
Uses the Jelly encoding. Try it online!.
J, 4 bytes
#~#\
Usage
f =: #~#\
f 'Why'
Whhyyy
f 'SKype'
SKKyyyppppeeeee
f 'LobbY'
LoobbbbbbbYYYYY
f 'A and B'
A aaannnnddddd BBBBBBB
Explanation
#~#\ Input: s
#\ Computes the length of each prefix of s
This forms the range [1, 2, ..., len(s)]
#~ For each value in the range, copy the character at the
corresponding index that many times
Return the created string
Brainfuck, 15 bytes
,[>+[->+<<.>],]
Pretty straightforward implementation, shifting the memory space by 1 for each input char. Requires an interpreter that gives 0 on EOF, and 32-bit/arbitrary precision cells for inputs longer than 255 chars.
Try it online! (Note: TIO uses 8-bit cells)