#!/usr/bin/perl
########################################################################
#
# $Id$
#
# Copyright (c) Okunev Igor gosha@prv.mts-nn.ru 2002
#
########################################################################
use strict;
my ( $small_html, $html, $old_color, $bool );
undef $/; $html = <STDIN>; $/ = "\n";
$html =~ s#</([^>]+)>(\s*)<\1>#$2#gs;
foreach $small_html ( split /\<\/FONT\>/, $html ) {
unless ( $small_html =~ s/^(\s*)<FONT color=#$old_color>/$1/s ) {
if ( $small_html =~ m/<FONT color=#([0-9A-Fa-f]{6})>/s ) {
$old_color = $1;
}
$small_html = '</FONT>' . $small_html if $bool++;
}
print $small_html;
}