Homework for Formal grammar course about finding word that corresponds in specified grammar