12871 in words is written as :

Twelve Thousand Eight Hundred and Seventy One