code: func optional(a *Automaton) *Automaton {
  	ans := newEmptyAutomaton()
  	ans.createState()
  	ans.setAccept(0, true)
  	if a.numStates() > 0 {
  		ans.copy(a)
  		ans.addEpsilon(0, 1)
  	}
  	ans.finishState()
  	return ans
  }
docs: /*
  Returns an automaton that accepts the union of the empty string and
  the language of the given automaton.
  
  Complexity: linear in number of states.
  */