DEV Community

loading...

Discussion on: Coding Puzzles: Week of 4/8

Collapse
choroba profile image
E. Choroba
#! /usr/bin/perl
use warnings;
use strict;
use feature qw{ say };

use Math::BigInt;

chomp( my $cases = <> );
for my $case (1 .. $cases) {
    chomp( my $n = <> );
    (my $i = $n) =~ tr/4/3/;
    my $j = 'Math::BigInt'->new($n) - 'Math::BigInt'->new($i);
    say "Case #$case: $i $j";
}