Fill in the lakes
sed -r, 27 24 (27 with -r
)
24 (27):
:;s/(#|@) ( *#)/\1@\2/;t
27 (30):
:e;s/([#@]) ( *#)/\1@\2/;te
Competes with the better of the two perl solutions
Perl, 25
s/# +#/$_=$&;y| |@|;$_/ge
Perl (>= v5.9.5), 24 chars
Run with perl -p
:
1while s/#.*\K (?=\S)/@/
This requires Perl 5.9.5 or later to use the special escape \K
.