**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 ‘1’ as the substring or the input string starts with ‘1’ or ends with ‘1’.

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 ‘X’ 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 ‘Y’ and prints ‘A’ as the output. The state ‘Y’ on getting ‘1’ as the input it remains in the state of itself and prints ‘A’ as the output and on getting ‘0’ as the input it comes back to the state ‘X’ and prints ‘B’ as the output.

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

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

**Explanation:**

In the above diagram, the initial state ‘X’ 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 ‘Y’ and prints ‘A’ as the output. The state ‘Y’ on getting ‘1’ as the input it remains in the state of itself and prints ‘A’ as the output and on getting ‘0’ as the input it comes back to the state ‘X’ and prints ‘B’ as the output.

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

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

## Recommended Posts:

- Difference between Pushdown Automata and Finite Automata
- Finite Automata with Output (Set 6)
- Finite Automata with Output (Set 3)
- Finite Automata with Output (Set 11)
- Designing Finite Automata from Regular Expression (Set 1)
- Designing Non-Deterministic Finite Automata (Set 3)
- Practice problems on finite automata | Set 2
- Designing Deterministic Finite Automata (Set 1)
- Designing Deterministic Finite Automata (Set 2)
- Designing Finite Automata from Regular Expression (Set 6)
- Designing Deterministic Finite Automata (Set 3)
- Designing Deterministic Finite Automata (Set 4)
- Designing Deterministic Finite Automata (Set 5)
- Designing Deterministic Finite Automata (Set 9)
- Designing Deterministic Finite Automata (Set 8)
- Designing Deterministic Finite Automata (Set 7)
- Designing Deterministic Finite Automata (Set 6)
- Designing Deterministic Finite Automata (Set 10)
- Designing Deterministic Finite Automata (Set 11)
- Designing Non-Deterministic Finite Automata (Set 1)

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.