# How many way can you encode a five letter word

I have a solution for this problem, but the way iv carried it out seem a bit long and am wondering if and only if my ans is correct if there is a shorter method or maybe and alternate way of looking at the problem.

So here is the question, ignore the first part of the problem, though I do believe it could be used to solve the second part.

Question

Consider a language short speak that has only a 5 letter alphabet A,B,C,D and E and in which all words have either 1,2,3,4 or 5 letter. Repetition of letter in a single word is permitted in short speak.

a) What is the maximum number of possible words in short speak? Do not consider rules of spelling in English.

We consider a general, so-called mono-alphabetic cipher in which each alphabetical letter in a plain text message is uniquely coded to another, different letter in the alphabet and vice versa. One example of suck a cipher is a Caesar 'shift 2' cipher in which A is encoded as C and B is encoded as D and so on.

b) How many ways are there to encipher a 5 letter short speak word in which no letter is repeated?

My solution

My first assumption is that the five word can be of the form : AAAAA, as indicated by ''Repetition of letter in a single word is permitted in short speak''

So I used the following diagram to workout the possible way to encipher.

My digram follow the logic that the first letter I can pick to encode A can be either B C D E which means I have 4 possible choices, so I picked D. For the second letter I cant choose D as this is not allowed therefore I only have 3 possible choices in this case I picked B and so forth now because all letter in the word are the same by the time I encipher the fourth letter all my possible choice to encipher the 5th are gone so that letter remains the same. Therefore in total I have 24 ways to encipher the word.

Now if I change the five letter word as to AAEDB for example and use the same method as shown in diagram below I get 48 ways to encipher.

So depending if the word is all the same letter or one letter different means a different out come, so there are in total 72 ways that a five letter word can be encipherd.

Is this correct? If so is there a shorter more compact way to look at this type of problem that I may have missed.

a) Maximum number of words. There are $$5^5$$ words of length $$5$$, $$5^4$$ of $$4$$, etc.
So in total: $$5^5 + 5^4 + 5^3 + 5^2 + 5^1$$
b) If no letter is repeated there are 5 choices for the first letter, 4 for the second etc, giving a total of $$5! = 120$$ different words.