L is regular. Because we cannot have two ab in a string without having a ba or vice-verse. So, there are only 3 states possible- one where number of "ab" and "ba" are same, one where number of "ab" is 1 more than number of "ba" and the final one where number of "ba" is 1 more than number of "ab". So, we just need a finite state automata to represent this.