I need to give a context-free grammar for each of the examples:
$L_1=\{a^hb^ka^mb^n : h+k=m+n\}$
$L_2=\{a^ib^ja^k : (i=j \,\,\,\, and \,\,\,\, k≥0) \,\,\,\, or \,\,\,\, (i\ge0 \,\,\,\, and \,\,\,\, j>k)\}$
I've done many simple examples and have improved on my skills to generate CFGs from grammars. I normally start off by solving for the simplest case, then building up from there. However, I'm confused as to where I can start to find the solutions to these problems.
Edit: This post has been marked as a duplicate and linking to here. However, my question is not about how to prove that a language is context free. It's about generating a context-free grammar from a given language.