On the Reduction Lemma (the existence of an $(n-1,M,d-1)$-code) We want to prove the following Lemma:

Lemma. Let $A$ be an alphabet of size $|A|:=q\in\Bbb Z_{\geq 2},n\in \Bbb Z^+$ be a positive integer and $d \geq 2$ be a positive integer.  If a $q$-ary $(n,M,d)$-code exists, then a $q$-ary $(n-1,M,d-1)$-code also exists.

My attempt. Let $C\subseteq A^n$ be a $q$-ary $(n,M,d)$-code. Then, $\forall x\in C$, let $\overline x \in A^{n-1}$ be the word obtained by deleting the
last symbol and so we construct the code $\overline C = \{\bar{x}\in A^{n-1}:x\in C\}$. 
Claim: We will prove that $\forall x\neq y \in C$ it is $d(\overline x,\overline y)\geq d-1$.
Take $x:=(x_1,\dots,x_n)\neq y:=(x_1,\dots,x_n)\in C$. Since $d(C)=d$, we have $d(x,y)\geq d$, so $x$ and $y$ differ in at least $d$ positions. Now lets do something weird. Forget the $n$-th digit of the codewords $x\neq y \in C$. Then,  there are at least $d-1$ digits, other than the $n$-th digit of $x$ and $y$, where $x$ and $y$ differ. This tells us that 
$$d-1\leq |\{i\in \{1,\dots,n-1\}:x_i\neq y_i\}|\overset{\mathrm{def}}{=} d(\overline{x},\overline{y}).$$
The first consequence of the claim is that, just because $d=d(C)\geq 2$, $\overline x$ and $\overline y$ are dinct when $x$ and $y$ are dinct.\footnote{Note that the fact that $d=d(C)\geq 2$ rules out the case where $x,y$ differ only in the last digit, where we would have that $x\neq y$ but $\overline{x}=\overline{y}$.} Therefore $|C|=|\overline{C}|=M$.
The second consequence is that $d(\overline C)\geq d-1$. In fact $d(\overline C)\in\{d-1,d\}$. 
Now how can we rule out the case where $d(\overline C)=d$ and so say that $d(\overline C)=d-1$, in order to complete the proof?
Thank you.
 A: Your idea of removing one letter in the codewords is a good one. But it must not necessarily the last one. The trick is to look at words where the minimal distance is attained and then remove a position in all code words where the minimum is attained:
Let $C$ be a $[n,M,d]$-code. Fix code words $c, c'$ with $c \neq c'$ and $d(c,c') = d$. Since $c \neq c'$, there is $i \in \{1, \dots, n\}$ with $c_i \ne c_i'$. Now, consider the projection
$$\pi: A^n \to A^{n-1}$$
that forgets component $i$. 
Then we define $C':= \pi(C)$. 
Let's check $C'$ is a $[n-1,M,d-1]$ code. The parameter $n-1$ is trivially satisfied. Let's check the parameter $M$. Can the amount of words have changed by forgetting one coordinate? If this would be the case, then after forgetting a coordinate, two different words must have become the same word. But this implies that the distance between these two words in the original code is $1$, which contradicts our assumption that $d \geq 2$. Thus $C'$ has $M$ code words. Finally, because we forget only one coordinate the minimal distance $d'$ of $C'$ must be $d' \geq d-1$. Since $d(\pi(c), \pi(c')) = d-1$, we see that in fact $d'=d-1$. Thus the minimal distance of $C'$ is $d'=d-1$, as desired.
