Permutations of passwords without a specific substring I've been a little bit stuck on a problem for my discrete math class.

You need to set a password as a string which is a permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Your
  birth day is 12/24 (Dec 24), and so for safety purposes, your password should not contain either
  of the substrings 12, 24. For example, 0213456789 is ok, but none of {0123456789, 0132456789,
  987654321, 0113456789, 0312456789} are acceptable. How many possible passwords can you set?
If you picked a password by gerenating independent random permutations, with each permutation
  being equally likely, what is the expected number of tries before you get an acceptable password?

I've been thinking that the second part should just be 1/p, since it's asking for the number of tries to success, but I don't really know how to go about finding a combination to solve the first part.
 A: Use the inclusion/exclusion principle:


*

*Include the total number of permutations, which is $10!$

*Exclude the number of permutations containing "$12$", which is $9!$

*Exclude the number of permutations containing "$24$", which is $9!$

*Include the number of permutations containing "$124$", which is $8!$



Hence the number of legal permutations is:
$$10!-9!-9!+8!$$
Hence the probability to get a legal permutation is:
$$\frac{10!-9!-9!+8!}{10!}=\frac{73}{90}$$
Hence the expected number of tries before getting a legal permutation is:
$$\sum\limits_{n=1}^{\infty}n\cdot\left(1-\frac{73}{90}\right)^{n-1}\cdot\left(\frac{73}{90}\right)=\frac{90}{73}$$
A: A hint for you, how to calculate a number of non-acceptable passwords. Place two digits "12" into the beginning of the password. You can place all other digits into the remaining eight positions by $8!$ ways. Then consider all possible nine positions for the substring "12" in the password and summarize results. Then do the same for the "24" substring and find the total.
This total will be a little wrong, because you've actually counted passwords with the "124" substring two times, so you need to subtract all such passwords from the total.
