Number of possible passwords with same characters We have a password with length of 6 characters, out of a possible 27 letters, 10 digits and 8 special characters.
My questions are:

*

*A: How many possible combinations there are?


*B: How many combinations have at least two same characters?


*C: How many combinations have at least one special character?


*D: How many combinations have exactly two same characters (and others are different characters)?
The answer to A is $(27+10+8)^6$ but B, C and D are a mystery to me. Could I have some advice on the problem?
 A: *

*B:  Consider the opposite event, that no characters are repeated.  Choose the first character.  Once having chosen the first character, choose the second character noting that it can not be the same as the first.  Then choose the third character noting it cannot be either of the first two characters, etc...  Apply rule of product and conclude.


 $45\times 44\times 43\times 42\times 41\times 40$, the falling factorial written commonly as $~_{45}P_6$, as $P(45,6)$, or my preference being $45\frac{6}{~}$

Using this count, subtracting it away from the result from A gives the count we are interested in

 $45^6-45\frac{6}{~}$


*

*C: Again, consider the opposite event, the number of sequences with no special characters.  The same logic used in A can be used here to count the opposite event.  The same logic used in B taking the opposite event away from the overall total will work here as well.


 $45^6 - 37^6$


*

*D: Pick the character which is to be repeated.  Pick the locations of that character.  Then, from left to right, pick what characters occupy the remaining positions noting that we may not repeat for these.


 $\binom{6}{2}45\frac{5}{~}$

A: You're right about $A$: the total number is $45^6$. For $B$ you could count the ones that have all characters different, so $45 \times 44 \ldots \times 40$ and subtract that from the total. For C you can count those without a special character and subtract that amount from the total (so $45^6- 37^6$).
$D$ is the trickiest one: there you can first choose the duplicated character in $45$ ways (all are possible), and then the two positions among the $6$ where they will occur (in $\binom{6}{2} = 15$ ways) and then the $4$ remaining positions go like the different characters under B, with starting with $44$ options, so we get $45 \times 15 \times (44 \times 43 \times 42 \times 41)$ ways.
