I need to bulid a context-free grammar for $\qquad \mathscr{L_4}=\{w\in\{a,b,c\}^* \mid w\text{ is not palindrome at all}\}$ Not palindrom at all:We will say that a word $w$ is not palindrome at all if for all $i$ such that $1\leq i\leq |w|$ the $i$ letter from the beginning of $w$ is not the same like the $i$ letter of $w$ from the end, for example $abbacb\in \mathscr{L_4}$ but $ca\color{gray}bba\color{gray}bcb\notin\mathscr{L_4}$, the word must contain a even number of digits, because if there were an odd number of digits, so the middle digit equals to itself. My attempt: Let's denote $S_{\text{pal}}$ from palindrome grammar and  $S_{\neg\text{pal}}$ for the not palindrome at all grammar $$\\S_{\neg\text{pal}}\to a S_{\neg\text{pal}}b\big|bS_{\neg\text{pal}}a\big|aS_{\neg\text{pal}}c\big|cS_{\neg\text{pal}}a\big|cS_{\neg\text{pal}}b\big|cS_{\neg\text{pal}}b\big|\epsilon$$Similar question here.I'm not sure if my attempt is correct or not
Context-free grammar fornot-at-all palindromes
formal languages;context free;formal grammars
Your attempt looks correct to me$$\\S_{\neg\text{pal}}\to \color{red}a S_{\neg\text{pal}}\color{blue}b\big|\color{blue}bS_{\neg\text{pal}}\color{red}a\big|\color{red}aS_{\neg\text{pal}}\color{green}c\big|\color{green}cS_{\neg\text{pal}}\color{red}a\big|\color{blue}bS_{\neg\text{pal}}\color{green}c\big|\color{green}cS_{\neg\text{pal}}\color{blue}b\big|\varepsilon$$Let us say that for a word of length $n$ such that $n\in\mathbb{N}$ is even  for each letter in the $i$ from the begining  $1\leq i\leq n$ you ensure that in the place $i$ from the end you have a diffrent letterfor example: $\color{red}a\color{blue}b\color{green}c\color{blue}b\color{red}a\color{blue}b\in \mathscr{L_4}$