#!/usr/bin/perl -w

use strict;

my $l = undef;
while(1)
{
    if(!defined($l))
    {
	$l = <STDIN>;
	if(!defined($l))
	{exit}
    }
    if($l =~ /^--- New file ---/)
    {
	my $first= $l;
	my $second = <STDIN>;
	$second =~ s%^\+\+\+ ([^ \t]+)%\+\+\+ b/$1%;
	my $fname= $1;
	$first =~ s%^--- New file ---%--- a/$fname\t00\/00\/00\/00 00:00:00%;
	print $first;
	print $second;
	my $lines=0;
	my @nf;
	while(defined($l=<STDIN>) && !($l =~ /^---/))
	{
	    push @nf,"+ $l";
	    $lines++;
	}
	print "@@ -0,0 +1,$lines @@\n";
	print @nf;
    }
    else
    {
	print $l;
	$l = undef;
    }
}
