#!/usr/local/bin/perl my @num = qw(零 一 二 三 四 五 六 七 八 九 十 十一); use Lingua::EN::Inflect 'PL'; while () { chomp; my $c = ; chomp $c; $_=lc; next unless length $c; my $pl = PL($_); $dict{$pl} = $dict{$_} = $c; $dict{uc($pl)} = $dict{uc($_)} = $c; $dict{join(' ', map ucfirst, split(' ', $pl))} = $dict{join(' ', map ucfirst, split(' ', $_))} = $c; } local $/; my $d = <>; $d =~ s/\bAppendix ([A-Z])\b/附錄 $1/g; $d =~ s/\bChapter\s+(\d+)\b/第$num[$1]章/g; for (sort { length$b <=> length$a } keys %dict) { $d =~ s/(?