12787 in words is written as :

Twelve Thousand Seven Hundred and Eighty Seven