Count the occurences of given substring in a String

Get a String and Substring and count the occurrence of substring in string.

Sample Input 1:

entertainment en

Sample Output 1:


Program or Solution


Program Explanation

check whether first character of sub string is equal to any character in string.

If it is equal, then check remaining characters are equal to the characters in substring.

else move to next character.

Tech Events