Important point to note here is that letters are not distinct , i.e we can have a code as aaaa or aaaaa for 4 or 5 letter words respectively.

This question is similar to the question

if-a-code-word-is-defined-to-be-a-sequence-of-different-126652.htmlIn which we have selected 4 letters from 10 and 5 letters from 10 but in this case the letters have to be distinct.

so using

P^{10}_{4} and

P^{10}_{5}we get

\frac{10!}{6!} and

\frac{10!}{5!} But cannot we use the same logic here to select 4 letters from 26 or 5 letters from 26, why?... because the letters are not distinct ( letters can be repeated ) and we cannot use the general permutation formula when there is repetition .

so we cannot use

P^{26}_{4} + P^{26}_{5}if this question were each four letter code and 5 letter code are made of distinct elements then the answer, I think could be

P^{26}_{4} + P^{26}_{5}. 4 distinct letters can be selected from 26 or 5 distinct letters can be selected from 26 to make the 4 digit codes or 5 digit codes .

so if

"distinct " is not mentioned then we automatically should assume that there can be repetitions .

So in this question since no distinct word is mentioned , we can assume letters can we repeated to form the codes.Unlike the sum in the link above.

Hope this will prevent many people from wondering why we are solving two very similar questions in two very different ways. like I myself was wondering for a while before this eureka moment

if Anyone can add or verify or correct the reasoning that I have used It would certainly help.