#!/usr/bin/env perl

use strict;

my(@data);

while (<>) {
	push(@data, $_)	if ((/\# <common>/i .. /\# <\/common>/i) and (!/\# <\/?common>/i));
}

while (<STDIN>) {
	if ((1 ... /\# <common>/i) or (/\# <\/common>/i ... eof())) {
		print($_);
	} elsif (@data) {
		print(@data);
		@data = ();
	}
}
