#!perl -wln
use strict;
our %subs;
my %uniq;
for my $sub (lc =~ /(?=(\w{4}))/g) {
    next if $uniq{$sub}++;
    exists $subs{$sub} ? undef($subs{$sub}) : ($subs{$sub} = $_);
}
END {
    open my $ques, '>', 'questions' or die "Couldn't open questions: $!";
    open my $ans, '>', 'answers' or die "Couldn't open answers: $!";
    while (my ($sub, $word) = each %subs) {
	if (defined $word) {
	    print $ques $sub;
	    print $ans $word;
	}
    }
}
