How many strings of length 8 formed using letters from $\{a,b,c,d\}$ contain exactly one pair of adjacent letters that are the same?
Can any kind soul give some hint?
How many strings of length 8 formed using letters from $\{a,b,c,d\}$ contain exactly one pair of adjacent letters that are the same?
Can any kind soul give some hint?
Hint:
How many strings of length $8$ using those letters have the same first and second letters and have no other adjacent letters that are the same?
How many strings of length $8$ using those letters have the same second and third letters and have no other adjacent letters that are the same?
First count the number of strings of length $7$ with no adjacent letters the same. We have four choices for the first letter, and three for each subsequent letter, so this is $4\times 3^6$.
Now choose one of these seven letters to be the repeated letter. So we get
$$7\times 4\times 3^6=20412$$