Indirectly:
There are 265 ways to arrange 5 alphabet letters in a row
That's 11881376 ways
We need to subtract the unacceptab;le ones:
1. Those which have exactly 5 letters in a row all the same
12345
XXXXX
There are 26 ways to choose what X represents.
That's 26 ways
That's 26 ways to subtract
2. Those which have exactly 4 letters in a row the same:
12345 12345
XXXX- -XXXX
Choose the position for the four in a row in 2 ways
Choose the X 26 ways
Choose the - 25 ways
That's 2x26x25 = 1300 more ways to subtract
3. Those which have exactly 3 letters in a row on either end:
12345 12345
XXX-- --XXX
Choose the position for the three in a row in 2 ways
Choose the X 26 ways
Choose the - that's next to an X in 25 ways
Choose the - on the end in 26 ways (it can be the same as X or its neighbor)
That's 2x26x25x26 = 33800 ways to subtract
4. Those which have exactly 3 letters in a row in the middle:
12345
-XXX-
Choose the X 26 ways
Choose the left - in 25 ways
Choose the right - in 25 ways
That's 26x25x25 = 16250 more ways to subtract
Total = 11881376 - 26 - 1300 - 33800 - 16250 = 11830000
------------------------------
Direct.
1. Those which have no two in a row:
12345
-----
Choose letter #1 26 ways
Choose letter #2 25 ways
Choose letter #3 25 ways (can be the same as 1 but not 2
Choose letter #4 25 ways (can be the same as 1 or 2 but not 3
Choose letter #5 25 ways (can be the same as 1 or 2 or 3 but not 4
That's 26x25x25x25x25 = 10156250
2. Those which have exactly 1 pair of letters in a row.
(a) 12345 (b) 12345 (c) 12345 (d) 12345
XX--- -XX-- --XX- ---XX
Choose the position for the 1 pair in a row in 4 ways
Choose the letter for X in 26 ways
Choose letter #3 in (a), letter #4 in (b), letter #2 in (c)
and letter #3 in (d) in 25 ways
Choose letter #4 in (a), letter #5 in (b), letter #1 in (c)
and letter #2 in (d) in 25 ways
Choose letter #5 in (a), letter #1 in (b), letter #5 in (c)
and letter #1 in (d) in 25 ways
That's 4x26x25x25x25 = 1625000
3. Those which have exactly 2 pairs of letters in a row
on either end.
12345 12345
XXYY- XXYY
Choose the position for the 2 pair in a row in 2 ways
Choose the letter for X in 26 ways
Choose the letter for Y in 25 ways
Choose the - in 25 ways
That's 2x26x25x25 = 32500
4. Those which have two pairs on each end:
12345
XX-YY
Choose the letter for X in 26 ways
Choose the - in 25 ways
Choose the letter for Y in 25 ways
That's 26x25x25 = 16250
Total = 10156250 + 1625000 + 32500 + 16250 = 11830000
Edwin