Longest common subsequence: Difference between revisions
m
→header/Perl: future-proof for 5.36, use new bitwise string operator
m (Swapped order of two paragraphs.) |
SqrtNegInf (talk | contribs) m (→header/Perl: future-proof for 5.36, use new bitwise string operator) |
||
Line 2,151:
===Alternate letting regex do all the work===
<syntaxhighlight lang="perl">
use warnings;
use feature 'bitwise';
print "lcs is ", lcs('thisisatest', 'testing123testing'), "\n";
Line 2,161 ⟶ 2,160:
{
my ($c, $d) = @_;
for my $len ( reverse 1 .. length($c &. $d) )
{
"$c\n$d" =~ join '.*', ('(.)') x $len, "\n", map "\\$_", 1 .. $len and
Line 2,169 ⟶ 2,168:
}</syntaxhighlight>
{{out}}
<pre>lcs is
=={{header|Phix}}==
|