#!/usr/bin/perl

use strict;

my(@headers) = "Received";

my($strip);

while (<STDIN>) {
	if (1 ... /^\r?\n?$/) {
		$strip = 0 if (($strip) and !(/^\s+\S/));
		foreach my $header (@headers) {
		    if (/^${header}:/) {
			$strip = 1;
			@headers = ();
		    }
		}
		print($_) unless ($strip);
	} else {
		print($_);
	}
}
