Find nth number which does not contain the digit c

This problem was given to 9-graders. We write down numbers except for the ones which contain the digit c. Find the nth such number. I looked at the indications, but the algorithm used there stumped me. I will describe in here: if $$c \ne 0$$, then we transform the number n - 1 (since 0 is part of the series) in the 9th base. Then each digit in the representation of the 9th base which is bigger of equal than c and smaller than 9 will be incremented with 1. The number we obtain is the number we are looking for, BUT IN BASE 10. How? Could anyone explain it to me? Also, please, be patient since I have just started Competitive Programming and I am not really that good.

Let's do it in base 3.

Here are the first 8 numbers without 2 (left column) and the first 8 numbers without 1 (right column), with zero padding:

000    000
001    002
010    020
011    022
100    200
101    202
110    220
111    222


Hopefully you can take it from here.