Programming
(120 marks) Write regular expressions and design a DFA that accepts exactly the strings over the alphabet {A, B,…, Z} in which every double ‘0’ (i.e., pair of consecutive ‘O’s) occurs before every double ‘E’ (i.e., pair of consecutive ‘E’s). Empty strings should be accepted as well. For instance, your DFA should accept the strings “FOODFORTHOUGHT”, “LOOKATTHESHEEP”, “DONOTFEEDTHEPIGEONS”, and “ILOVECPSC” but not “THISBEEFISGOOD”. Clearly indicate the meaning of each state. You can use A—C, F—H to represent letter intervals in your DFA labels, i.e., A —C, F—H means A, B, C, F, G, H.