Answer:
Part (A) The required ways are 792.
Part (B) The required ways are 101376.
Step-by-step explanation:
Consider the provided information.
Part (A) The alphabet {a, b}
The length of strings is 12 that containing exactly five a's.
The number of ways are: 
After filling "a" we have now 7 places.
For 7 places we have "a" and "b" alphabet but we already select a's so now the remaining place have to fill by "b" only.
Thus, the required ways are: 
Part (B) The alphabet {a, b, c}
We have selected five a's now we have now 7 places.
For 7 places we have "b" and "c".
Thus, there are 2 choices for each 7 place that is 
Therefore the total number of ways are: 
Thus, the required ways are 101376.