Source: https://elearningatria.files.wordpress.com/2013/10/cse-v-formal-languages-and-automata-theory-10cs56-solution.pdf