I am teaching myself formal languages, and yesterday i got stuck at an exercise asking for a context free grammar for the language:
$ L = \{x \in \Sigma ^{+} | \ \forall w \in \Sigma ^{+} \ x \neq ww\} $ with $ \Sigma = \{a,b\}$
I am trying some rules of the form
$L \Rightarrow a | b $
$S \Rightarrow aSbS\ |\ bSaS\ |\ L\ |\ ab\ |\ ba $
However this is wrong since for example the grammar does not accept 3-symbol strings. I am a little bit stuck with it so any help would be greatly appreciated.