Program to find all the patterns of 0(1+)0 in the given string | FACE Prep
Published on 11 Mar 2020
Program to find all the patterns of 0(1+)0 in the given string is discussed here. Given a string containing 0's and 1's, find the total number of 0(1+)0 patterns in the string and output it.
0(1+)0 - There should be at least one '1' between the two 0's.
For example, consider the following string.
01101111010 - count = 1
01101111010 - count = 2
01101111010- count = 3
Algorithm to find all the patterns of 0(1+)0 in the given string
- Input the given string.
- Scan the string, character by character.
- If the given pattern is encountered, increment count.
- Print count.
Program to find all the patterns of 0(1+)0
Enter the string : 01101111010
Number of patterns found : 3
If you have any feedback about this
article and want to improve this, please write to firstname.lastname@example.org