#!usr/local/bin/perl

## This program will get all the cells positions that are empty and fill them with zeros.
## Essential to use in the free open-source software.

open (IN, "$ARGV[0]") ||
	die;

open (OUT, ">$ARGV[0].out") ||
	die;

while ($line = <IN>) {
	chomp $line;

## Getting free of tabs inside the line;

	while ($line =~ /\t\t/) {
		$line =~ s/\t\t/\t0\t/g;
	}
	
## Sometimes there's a tab in the final of the line, but the last cell is empty. 
## This loop checks if there are 18 colluns in every line.
	
	while ($line =~ /\t$/) {
		chop $line;
	}
	@array = split (/\t/, $line);
	$diferenca = 18 - ($#array);
	$i = 1;
	while ($i <= $diferenca) {
		$line.= "\t0";
	$i++;
	}
	print OUT ("$line\n");
}

close IN;
close OUT;