Exact separation of two identical symbols: if exactly g objects must lie between two Xs, their positions differ by g+1. Choose the left position, place both identical Xs, then arrange the remaining multiset. There is no factor of two for swapping the Xs. For example, with XX and distinct B, C, D, exactly one object between the Xs gives three position pairs and 3! remaining orders, hence 3⋅3!=18 strings.
Alternating categories: choose a permitted category pattern first, then fill each category’s places with its own distinct or repeated objects. Category counts differing by more than one make strict alternation impossible. For equal positive counts, either category may start; when counts differ by one, the larger category must occupy both ends.
Relative order with repeats: interpret the statement literally. For “all As before all Bs”, choose the positions occupied by As and Bs, fill those positions with all As followed by all Bs, and arrange the remaining symbols with their multiplicities. For A, A, B, B, C, the BA subsequence is AABB; inserting C in its five possible places gives five strings. By contrast, “the first A appears before the first B” permits other BA interleavings. For A, A, B, B, B, the first condition allows only AABBB, while the second fixes the first letter as A and permits 3!4!=4 strings. These are different events, so do not automatically divide by two.