Problem: Binary match pattern is kind of search which returns the number of times the pattern is matched in a given string.
Write a function which returns the number of times the pattern is matched in a given string. The pattern will be in binary format meaning combination of 0 and 1's.
Rules: if the number is 0 in the pattern then it should be vowel and if the number is 1 then it should be consonant.
Searching string will be of lower case only and will be of one word only.
Pattern will be in a string.
Explanation: In the above pattern first and last numbers are zero's so the letters should start and end with vowel and as the second number is 1, the middle letter is consonant. So the function should search for such kind of words in the word and return the count. In the above given input it
matches only twice and they are:
Problem: Binary match pattern is kind of search which returns the number of times the pattern is matched in a given string.
Write a function which returns the number of times the pattern is matched in a given string. The pattern will be in binary format meaning combination of 0 and 1's.
Rules: if the number is
0
in the pattern then it should be vowel and if the number is1
then it should be consonant. Searching string will be of lower case only and will be of one word only. Pattern will be in a string.Example 1: : Input : Pattern: '010', Search String: 'amazing' Output: 2
Explanation: In the above pattern first and last numbers are zero's so the letters should start and end with vowel and as the second number is 1, the middle letter is consonant. So the function should search for such kind of words in the word and return the count. In the above given input it matches only twice and they are:
Example 2: Input: Pattern: 100, Search String : 'seesaw' Output: 1
Matches are: