Skip to main content
edited body
Source Link
Andreas Louv
  • 1.7k
  • 13
  • 25

Perl, 48 + 3 = 51 bytes

s/\./substr($^I,$.=pos,1)||$&/ge;$_.=substr$^I,$.

Bah cannot find a shorter solution. (Same approach as @Qwertiy's JavaScript's answer):

Requires.
Requires -pl and takes input from stdin and -i

$ perl -i'a...ce' -ple's/\./substr($^I,$.=pos,1)||$&/ge;$_.=substr$^I,$.' <<< '..b.d..f'
a.b.de..f

Perl, 48 + 3 = 51 bytes

s/\./substr($^I,$.=pos,1)||$&/ge;$_.=substr$^I,$.

Bah cannot find a shorter solution. (Same approach as @Qwertiy's JavaScript's answer):

Requires -pl and takes input from stdin and -i

$ perl -i'a...ce' -ple's/\./substr($^I,$.=pos,1)||$&/ge;$_.=substr$^I,$.' <<< '..b.d..f'
a.b.de..f

Perl, 48 + 3 = 51 bytes

s/\./substr($^I,$.=pos,1)||$&/ge;$_.=substr$^I,$.

Bah cannot find a shorter solution. (Same approach as @Qwertiy's JavaScript's answer).
Requires -pl and takes input from stdin and -i

$ perl -i'a...ce' -ple's/\./substr($^I,$.=pos,1)||$&/ge;$_.=substr$^I,$.' <<< '..b.d..f'
a.b.de..f
Source Link
Andreas Louv
  • 1.7k
  • 13
  • 25

Perl, 48 + 3 = 51 bytes

s/\./substr($^I,$.=pos,1)||$&/ge;$_.=substr$^I,$.

Bah cannot find a shorter solution. (Same approach as @Qwertiy's JavaScript's answer):

Requires -pl and takes input from stdin and -i

$ perl -i'a...ce' -ple's/\./substr($^I,$.=pos,1)||$&/ge;$_.=substr$^I,$.' <<< '..b.d..f'
a.b.de..f