I. Suppose that one monkey presses 10 keys at random. What is the probability that he types the word HAMLET if he is(a)allowed to repeat letters, and (b) not allowed to repeat letters?

I understand the sample space is 26^10, and I understand that there are 5 total ways the word HAMLET could appear given 10 spaces. However, I'm not sure why the answer is (5x26^4)/(26^10).

Where is the 26^4 coming from?

II. You are asked to select a password for a Web site. It must consist of five lowercase letters and two digits in any order. How many possible such passwords are there if (a) repetitions are allowed, and (b) repetitions are not allowed?

(a)The answer is (7c2)*(26^5)*(10^2)

I understand 7c2 (7 spots and choosing 2 numbers), however, why isn't the formula used for "with replacement", since we can use the same number in both spots? Why is 26^5 with regard to order? Also, why is 10^2 multiplied at the end? I thought that's what the 7c2 was counting.

(b) The answer is (7c2)*(26p5)*(10p2), but I basically have the same questions as above. How are they coming up with the different components? I'm not sure when to use each formula (i.e., with/without replacement, with/without regard to order).

Any help would be appreciated!