Artificial intelligent assistant

Context-Free Grammar construction when order isn't specified I'm having trouble constructing a grammar for > **L={wϵ{a,b}|n a(w)≠nb(w)}** So I need to construct a grammar for the language wherein the number of a's does not equal the number of b's. The farthest I've attempted is splitting the language into > **L={wϵ{a,b} *|na(w)>nb(w)}∪{wϵ{a,b}*|na(w)<nb(w)}** but I don't know where to go from there. What makes this problem challenging is that no order is specified so I don't even know where to begin. Thus, the second part of my questions is if there is any general rule I should follow when dealing with languages that don't stipulate an order.

**Hint:** The first step in your grammar should decide whether $n_{\mathtt{a}} > n_{\mathtt{b}}$ or $n_{\mathtt{a}} < n_{\mathtt{b}}$, and then the two "halves" of your grammar will then construct appropriate strings. This related question might help you.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy b1d99cdaab5c128b21740a57f31b5420