How many strings of length 5 of the letters A, B, C, D, and E contain exactly one A and exactly one D if repetition of letters is allowed?
We must have exactly 1 A and exactly 1 B the other 3 letters can be C,D,E repeats allowed, so that is 3^3=27 ways with order counting.
The other A and B must be slotted into the string. 5C2=10 places but either the A or B can go first so that is 20 places.
So I get 27*20 = 540 ways.
AD, 1 of each letter, 5! ways to arrange: 120
AD, 2 of one letter, 1 of another, 6 possible choosing of letters, 60 ways to arrange: 360
AD, 3 of one letter, 3 possible ways to choose, 20 ways to arrange: 60
Total 540 ways. :))