#Solution to Problem 1(a) on Assignment 2. Determine if the input has the form w#w #where w is a string over {a,b} #The idea is to repeatedly cross off the first non-crossed-out letter in the input and remember it, #then scan right to the #, right to the next non-crossed-out symbol, and if it matches the remembered #letter, cross it out. #When the first non-crossed out symbol is #, the next must be blank, and we accept. #State 0 : skip Xs and look for a,b or # 0 X 0 X R 0 a 1 X R 0 b 2 X R 0 # 5 # R #State 1: found a, look for # 1 a 1 a R 1 b 1 b R 1 # 3 # R #State 2: found b look for # 2 a 2 a R 2 b 2 b R 2 # 4 # R #State 3: look for matching a 3 X 3 X R 3 a 6 X L #State 4: Look for matching b 4 X 4 X R 4 b 6 X L #State 6, Head back to start 6 a 6 a L 6 b 6 b L 6 X 6 X L 6 # 6 # L 6 B 0 B R #State 5: All left-hand symbols have been crossed out, verify 5 X 5 X R 5 B -1 B R #there are no un-crossed-out letters on right.