#!/usr/bin/perl
$nostyle=1;
$dos=1;
while(<>){$text.=$_;}
$text=~s/content="Microsoft Word \d+"/content="wordclean.pl"/g;
$text=~s/(\r|\n)+/ /g;
$text=~s/<\/?o:.+?>//g;
$text=~s///g;
$text=~s/xmlns(:.+?)?=".+?"//g;
$text=~s/mso-.+?:\s?.+?'/'/g;
$text=~s/mso-.+?:\s?.+?;//g;
$text=~s/style=''//g;
$text=~s#style='.+?'##g if ($nostyle);
$text=~s///g;
$text=~s/class=\w+//g;
$text=~s/<\/?st1:\w+>//g;
$text=~s/\s+>/>/g;
$text=~s/>\s+>##g if ($nostyle);
$text=~s#(.+?)#$1#g;
$text=~s#]*>\s*##g;
$text=~s#(.+)#$1#g;
$text=~s/(<\w.+?>)/\n$1/g;
$text=~s/\n//g;
$text=~s#(html|body|head|tr|td|table|div)>#\n$1>#g;
$text=~s#\n##;
$text=~s#\n#\r\n#g if ($dos);
print $text;