Shortest common supersequence: Difference between revisions

Content added Content deleted
No edit summary
Line 73: Line 73:
return '' unless length($u) and length($v);
return '' unless length($u) and length($v);
my $longest = '';
my $longest = '';
for my $first ( 0..length($u)-2 ) {
for my $first ( 0..length($u)-1 ) {
my $char = substr $u, $first, 1;
my $char = substr $u, $first, 1;
my $i = index( $v, $char );
my $i = index( $v, $char );