#!/usr/bin/perl
use strict;

my $in=$ARGV[0];
my $out=$in; $out=~s/\.tre$/\.noroot\.tre/;
my $tree;
open(IN,$in)||die;
while(my $line=<IN>){
	chomp $line;
	$tree.=$line;
}
close IN;
$tree=~s/^\(.+?\(/\(/;
$tree=~s/\);$/;/;
open (OUT,">$out")||die;
print OUT $tree."\n";
close OUT;

