Abbreviations, automatic: Difference between revisions
m
→{{header|Perl}}: strict compliant
m (→{{header|Ruby}}: shaved off a line) |
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: strict compliant) |
||
Line 1,729:
Output is the same as for Perl 6.
{{trans|Perl 6}}
<lang perl>use
use utf8;
binmode STDOUT, ":utf8";
Line 1,735 ⟶ 1,736:
my($string) = @_;
my @words = split ' ', $string;
my $max = 0;
return '' unless @words;
map { $max = length($_) if length($_) > $max } @words;
for $i (1..$max
my %seen;
return $i if @words == grep {!$seen{substr($_,0,$i)}++} @words;
|