#!/usr/local/bin/perl -w
use Getopt::Std;

sub usage { <<EOM;
$0
	Used as standard pipe; output will have two (identical) trees
	for every tree in the input
EOM
}

my %opt;
getopts ('h', \%opt);

if ($opt{h}) { die usage(); }

my $curtree = "";
while (<>) {
  if (/^\(/) {
    print $curtree;
    print $curtree;
    $curtree = "";
  }
  $curtree .= $_;
}

print $curtree;
print $curtree;
