Post History
Perl, 73 bytes $_="A$/";$b=A;$a=$b++,s|^| |gm,s| (.*$a)(.*$/)|$&$1$b$a$2$&| until/Z/;say Explanation: # initialise output string and replacement character $_ = "A$/"; $b = A; #...
#2: Post edited
# Perl, 74 bytes- <!-- language-all: lang-perl -->
- $_="A$/";$b=A;$a=$b++,s|^| |gm,s| (.*$a)(.*$/)|$&$1$b$a$2$&|
while!/Z/;say- ## Explanation:
- ```
- # initialise output string and replacement character
- $_ = "A$/";
- $b = A;
- # (
- # set check character, update replacement character
- $a = $b++,
- # prepend a space to every line
- s|^| |gm,
- # find the line with check character
- # - replicate before and after
- # - adjust check -> check+replacement+check
- # - fix up space count
- s| (.*$a)(.*$/)|$&$1$b$a$2$&|
- # )
- # stop when string contains a Z
while !/Z/;- # display result
- say
- ```
[Try it online!][TIO-mn48or7l][TIO-mn48or7l]: https://tio.run/##K0gtyjH9X1qcqpCWmlhSWpSqoF6cWKlu/V8l3lbJUUVfyVolydbRWiXRViVJW1unuCauRqEmPRfIUNDQ01JJ1ASR@po1KmoqhipJKokqRipqNVzlGZk5qYr6UfrWQMP@/wcA "Perl 5 – Try It Online"
- # Perl, 73 bytes
- <!-- language-all: lang-perl -->
- $_="A$/";$b=A;$a=$b++,s|^| |gm,s| (.*$a)(.*$/)|$&$1$b$a$2$&|
- until/Z/;say
- ## Explanation:
- ```
- # initialise output string and replacement character
- $_ = "A$/";
- $b = A;
- # (
- # set check character, update replacement character
- $a = $b++,
- # prepend a space to every line
- s|^| |gm,
- # find the line with check character
- # - replicate before and after
- # - adjust check -> check+replacement+check
- # - fix up space count
- s| (.*$a)(.*$/)|$&$1$b$a$2$&|
- # )
- # stop when string contains a Z
- until /Z/;
- # display result
- say
- ```
- [Try it online!][TIO-mn4a2q8j]
- [TIO-mn4a2q8j]: https://tio.run/##K0gtyjH9X1qcqpCWmlhSWpSqoF6cWKlu/V8l3lbJUUVfyVolydbRWiXRViVJW1unuCauRqEmPRfIUNDQ01JJ1ASR@po1KmoqhipJKokqRipqNVyleSWZOfpR@tZAs/7/BwA "Perl 5 – Try It Online"
#1: Initial revision
# Perl, 74 bytes
<!-- language-all: lang-perl -->
$_="A$/";$b=A;$a=$b++,s|^| |gm,s| (.*$a)(.*$/)|$&$1$b$a$2$&|
while!/Z/;say
## Explanation:
```
# initialise output string and replacement character
$_ = "A$/";
$b = A;
# (
# set check character, update replacement character
$a = $b++,
# prepend a space to every line
s|^| |gm,
# find the line with check character
# - replicate before and after
# - adjust check -> check+replacement+check
# - fix up space count
s| (.*$a)(.*$/)|$&$1$b$a$2$&|
# )
# stop when string contains a Z
while !/Z/;
# display result
say
```
[Try it online!][TIO-mn48or7l]
[TIO-mn48or7l]: https://tio.run/##K0gtyjH9X1qcqpCWmlhSWpSqoF6cWKlu/V8l3lbJUUVfyVolydbRWiXRViVJW1unuCauRqEmPRfIUNDQ01JJ1ASR@po1KmoqhipJKokqRipqNVzlGZk5qYr6UfrWQMP@/wcA "Perl 5 – Try It Online"
