map { $i = 0 ; $A[$i++] .= $& while /.{5,6}/g } <DATA>; # create array "A" from DATA splice @A, 8, 1, (); # delete '+' as 8th element $A[0] =~ s/.{5}\K/./g; # right-add '.' to 'zero'
map { $i = 0 ; $B[$i++] .= $& while /.{6}/g } # create array "B" from input map { chomp; $_ .= "." } <STDIN>; # add '.' to input lines
for $B (@B){
$i = 0;
for $A (@A){
$B eq $A and do { $num = $i ; last };
$i ++;
}
}
# eval expression, split and make the final array "ANS":
$i = 0;
$ANS[ $i++] .= $& while $A[$_] =~ /.{6}/g;
}
print map s/.$/\n/r
, @ANS; # remove trailing points and then print
__DATA__
....x.xxxxx.xxxxx.x...x.xxxxx.xxxxx.xxxxx.......xxxxx.xxxxx.xxxxx
....x.....x.....x.x...x.x.....x.........x...x...x...x.x...x.x...x
....x.....x.....x.x...x.x.....x.........x...x...x...x.x...x.x...x
....x.xxxxx.xxxxx.xxxxx.xxxxx.xxxxx.....x.xxxxx.xxxxx.xxxxx.x...x
....x.x.........x.....x.....x.x...x.....x...x...x...x.....x.x...x
....x.x.........x.....x.....x.x...x.....x...x...x...x.....x.x...x
....x.xxxxx.xxxxx.....x.xxxxx.xxxxx.....x.......xxxxx.xxxxx.xxxxx
bWFwIHsgJGkgPSAwIDsgJEFbJGkrK10gLj0gJCYgd2hpbGUgLy57NSw2fS9nIH0gPERBVEE+OwkJIyBjcmVhdGUgYXJyYXkgIkEiIGZyb20gREFUQQp1bnNoaWZ0IEBBLCBwb3AgQEE7CQkjIHJvdGF0ZSAnemVybycgdG8gYmVnaW5uaW5nCnNwbGljZSBAQSwgOCwgMSwgKCk7CSMgZGVsZXRlICcrJyBhcyA4dGggZWxlbWVudAokQVswXSA9fiBzLy57NX1cSy8uL2c7CSMgcmlnaHQtYWRkICcuJyB0byAnemVybycKCm1hcCB7ICRpID0gMCA7ICRCWyRpKytdIC49ICQmIHdoaWxlIC8uezZ9L2cgfQkjIGNyZWF0ZSBhcnJheSAiQiIgZnJvbSBpbnB1dAoJbWF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Hh4eC4uLi4ueC54eHh4eC54eHh4eC4uLi4ueC4uLi4uLi54eHh4eC54eHh4eC54eHh4eA==
Li4uLngueHh4eHgueHh4eHgueC4uLngueHh4eHgueHh4eHgueHh4eHguLi4uLi4ueHh4eHgueHh4eHgueHh4eHgKLi4uLnguLi4uLnguLi4uLngueC4uLngueC4uLi4ueC4uLi4uLi4uLnguLi54Li4ueC4uLngueC4uLngueC4uLngKLi4uLnguLi4uLnguLi4uLngueC4uLngueC4uLi4ueC4uLi4uLi4uLnguLi54Li4ueC4uLngueC4uLngueC4uLngKLi4uLngueHh4eHgueHh4eHgueHh4eHgueHh4eHgueHh4eHguLi4uLngueHh4eHgueHh4eHgueHh4eHgueC4uLngKLi4uLngueC4uLi4uLi4uLnguLi4uLnguLi4uLngueC4uLnguLi4uLnguLi54Li4ueC4uLnguLi4uLngueC4uLngKLi4uLngueC4uLi4uLi4uLnguLi4uLnguLi4uLngueC4uLnguLi4uLnguLi54Li4ueC4uLnguLi4uLngueC4uLngKLi4uLngueHh4eHgueHh4eHguLi4uLngueHh4eHgueHh4eHguLi4uLnguLi4uLi4ueHh4eHgueHh4eHgueHh4eHg=
....x.xxxxx.xxxxx.x...x.xxxxx.xxxxx.xxxxx.......xxxxx.xxxxx.xxxxx
....x.....x.....x.x...x.x.....x.........x...x...x...x.x...x.x...x
....x.....x.....x.x...x.x.....x.........x...x...x...x.x...x.x...x
....x.xxxxx.xxxxx.xxxxx.xxxxx.xxxxx.....x.xxxxx.xxxxx.xxxxx.x...x
....x.x.........x.....x.....x.x...x.....x...x...x...x.....x.x...x
....x.x.........x.....x.....x.x...x.....x...x...x...x.....x.x...x
....x.xxxxx.xxxxx.....x.xxxxx.xxxxx.....x.......xxxxx.xxxxx.xxxxx