Either is okay. But with "change" the preposition needs to change too. I just noticed one small thing with the original, it needs one more article. I'll show you both ways. "...replace the letter k with the letter d" "...replace the letter k with a d" "...change the letter k to a d."