Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/ABC-problem/Perl/abc-problem-3.pl
Normal file
17
Task/ABC-problem/Perl/abc-problem-3.pl
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict; # https://rosettacode.org/wiki/ABC_Problem
|
||||
use warnings;
|
||||
|
||||
printf "%30s %s\n", $_, can_make_word( $_,
|
||||
'BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM' )
|
||||
for qw( A BARK BOOK TREAT COMMON SQUAD CONFUSE );
|
||||
|
||||
sub can_make_word
|
||||
{
|
||||
my ($word, $blocks) = @_;
|
||||
my $letter = chop $word or return 'True';
|
||||
can_make_word( $word, $` . $' ) eq 'True' and return 'True'
|
||||
while $blocks =~ /\w?$letter\w?/gi;
|
||||
return 'False';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue