Assignment #3: formal languages Solution