Regular Expressions & Languages

Answer & solution
Official answer: D
Each return to the nonaccepting start state consumes either ab*b through the upper accepting state or ba*a through the lower one. Any number of such excursions may occur. Finally the path must stop in an accepting state, consuming ab* or ba*. Thus the language is (ba*a+ab*b)*(ab*+ba*), D.
A useful state-elimination decomposition is a sequence of complete excursions back to s, then one final unfinished excursion into u or v. Since s is nonaccepting, the final factor must consume at least one symbol; option C incorrectly admits ε. Option B disallows mixing the two types of returning excursion before the last segment.