Edit distance code