# TOC | Finite Automata with Output (Set 6)

**Prerequisite:** Mealy and Moore Machines, Difference between Mealy machine and Moore machine

In this article, we will see some designing of Finite Automata with Output, i.e., Moore and Mealy machines.

**Problem:** Construction of the machines that take set of all string over {0, 1} as input and produce ‘A’ as output if the input contains ‘101’ as the substring or the input string starts with ‘101’ or ends with ‘101’.

That is here we have,

Ε = {0, 1} and

Δ = {A, B}

where Ε and Δ are the input and output alphabet respectively.

**The required Moore machine is constructed below:-**

**Explanation:**

In the above diagram, the initial state ‘w’ on getting ‘0’ as the input it remains in the state of itself and prints ‘B’ as the output and on getting ‘1’ as the input it transits to a state ‘X’ and prints ‘B’ as the output. The state ‘X’ on getting ‘1’ as the input it remains in the state of itself and prints ‘B’ as the output and on getting ‘0’ as the input it transmits to the state ‘Y’ and prints ‘B’ as the output and so on for the remaining states.

Thus finally above Moore machine can easily give ‘A’ as the output on getting ‘101’ as input substring.

**The required Mealy machine is constructed below:-**

**Explanation:**

In the above diagram, the initial state ‘w’ on getting ‘0’ as the input it remains in the state of itself and prints ‘B’ as the output and on getting ‘1’ as the input it transits to a state ‘X’ and prints ‘B’ as the output. The state ‘X’ on getting ‘1’ as the input it remains in the state of itself and prints ‘B’ as the output and on getting ‘0’ as the input it transmits to the state ‘Y’ and prints ‘B’ as the output and so on for the remaining states.

Thus finally above Moore machine can easily give ‘A’ as the output on getting ‘101’ as input substring.

## Recommended Posts:

- TOC | Finite Automata with Output (Set 11)
- TOC | Finite Automata with Output (Set 5)
- TOC | Finite Automata with Output (Set 3)
- Compound Finite Automata (FA)
- TOC | Designing Deterministic Finite Automata (Set 8)
- TOC | Designing Deterministic Finite Automata (Set 9)
- TOC | Designing Deterministic Finite Automata (Set 5)
- TOC | Designing Deterministic Finite Automata (Set 4)
- TOC | Designing Deterministic Finite Automata (Set 7)
- TOC | Designing Non-Deterministic Finite Automata (Set 1)
- TOC | Designing Non-Deterministic Finite Automata (Set 5)
- TOC | Designing Deterministic Finite Automata (Set 11)
- TOC | Designing Deterministic Finite Automata (Set 6)
- TOC | Designing Deterministic Finite Automata (Set 10)
- TOC | Designing Non-Deterministic Finite Automata (Set 4)

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.