Find the substring


Given s and x , determine the zero-based index of the first occurrence of x in s

String s consists of lowercase letters in the range ascii(a-z)

String x consists of lower case letters and may also contain a single wildcard character ‘*’ that represents any one character.

Example:

S=”xabcdey”

X=”ab*de”

The first match is at index 1.

Function description:

Complete the function firstOccurence in the editor below. The function must return an integer denoting the zero based index of the first occurrence of string x in s.return -1 instead.

In this code we used some inbuilt functions in python such as index() and find()

We have provided code in python.

Code: