updated nfa accept method to support string transitions