CMIMC 2020 Power Problem 3.1

Let \mathcal{C} be a q-ary code with block length n and minimum distance d. Prove that

|\mathcal{C}| \leq q^{n-d+1}