How many permutations of the string "000011112222" contain the substring "2020"?
Problem 1067
Official solution
Solution:
Removing the string "2020", there are two 's, four 's, and two 's remaining. There are ways to arrange these digits, multiplied to possible placements for the string "2020", for a product of .
However, by PIE, we still need to subtract the number of arrangements with string "202020" and add back the number of arrangements with string "20202020", each of which account for and arrangements, respectively. This gives us a total of possible permutations.