Other orders of derivation are possible, e.g. bB→ bb could have been used immediately after the first application of CB→ BC.
Only the first two rules affect the length of the string being derived. As with part (c), when the 2nd rule (S → abC) is applied, string growth stops (and then neither of the first two rules can be used again). The last three rules cannot be used until the single use of S → abC provides the b. Hence the initial phase of derivation consists of n-1 applications of S → aSBC followed by the single application of S → abC, possibly interspersed with uses of CB → BC. (The rule CB → BC simply serves to move the B's left and the C's right.) At this point, the string contains n a's, one b and n-1 B's, and n C's. The remaining rules do not change the number of B's+b's, nor the number of C's+c's. The rule bB → bb serves to convert B's to b's left to right through the string. The rules bC → bc and cC → cc cannot be used until bB → bb has been used enough times to get a b adjacent to a C in the derived string. For this to happen, the string must be of the form anbpbC followed by a string of B's and C's (possibly 0 B's, definitely n C's). If there are in fact any B's in the rest of the string, then the derivation will block, since while the rule cC → cc converts C into c, there is not a rule cB → cb to convert B into b. If there were no B's in the rest of the string, then the string was of the form anbn-1bCn, and then the only possible rule applications are a single bC → bc followed by n-1 uses of cC → cc, yielding anbncn. So all strings derivable are of the form anbncn. Conversely, to derive anbncn, apply S → aSBC n-1 times followed by S → abC and then n(n-1)/2 applications of CB → BC to get anbBn-1Cn, then apply bB → bb n-1 times followed by bC → bc followed by n-1 uses of cC → cc to get anbncn.
AB → Aφ (B → φ in the left context A)
Aφ → Cφ (A → C in the right contextφ)
Cφ → CD (φ → D in the left context C)