So the first problem is
"In how many ways can we arrange the letters in the word Alabama."
and the second questions is
"In how many ways can we arrange three Mathematics books, five English books, four Science books and a dictionary?"
I can solve the first question by dividing $7!$ (number of letters) by $4!$ (number of times letter repeats), but I cannot solve the second question by dividing $13!$ (number of books) by $4!$ (number of science books) $ \cdot 3!$ (number of Mathematics books) $\cdot 5!$ (number of English books). The solution to the second question provided is $3! \cdot 5! \cdot 4! \cdot 4! = 414720$
I don't understand this solution. To me it seems that the situations are identical, so the same solution should apply. Why does the second solution work and what is the difference between two questions?
The second question implicitly asks for the books on each subject to be kept next to each other. Very very poorly worded, I know. Thus we have $3!$ ways for the maths, $5!$ for english, $4!$ for science, $1!$ for dictionary, and $4!$ ways to rearrange, and we multiply these.