[Math] NFA for $L = \{ w \in \{a,b,c\}^* : \text{at least one symbol appears only once in }w \}$

automataregular-language

Write an NFA to recognize the language
$$L = \{ w \in \{a,b,c\}^* : \text{at least one symbol appears only once in }w \}.$$

I'm not quite sure how to do this question. I don't know how to keep track of the number of times each letter appears in the string.

Best Answer

Hint. An NFA which recognises all words in which $a$ occurs only once is given by the following table. $$\matrix{&a&b&c\cr q_1&q_2&q_2&q_2\cr q_2&\hbox{none}&q_2&q_2\cr}$$ The initial state is $q_1$ and both states are accepting. (Note that, strictly speaking, "only once" means "once or not at all". If the question was supposed to be that at least one symbol occurs exactly once, make the accepting state $q_2$ only.)

If you are using the version of NFAs in which more than one initial state is permitted, you should now be able to finish the job. Good luck!

Related Question