How many distinct permutations of the letters of the word REDDER are there that do not contain a palindromic substring of length at least two? (A substring is a contiguous block of letters that is part of the string. A string is palindromic if it is the same when read backwards.)
Problem 855
Official solution
Solution:
If two identical letters are adjacent or have a single letter in between, there is clearly a palindromic substring of length (respectively) two or three. So there cannot be any such substrings.
Say we have a permutation of the word REDDER without any palindromic substrings. Let us call the first letter . The second letter has to be different, let us call it . The third letter cannot be or , let it be . Again, the fourth letter cannot be or , and we only have 3 letters to choose from, so it has to be . Continuing analogously, the fifth letter has to be , and the sixth letter has to be . So any word satisfying the problem statement has to be of the form . It is easy to check that such a word indeed does not have any palindromic substrings. can be any permutation of , , , giving a total of possibilities.