PROBLEM LINK:
Author: shakil ahmed
DIFFICULTY:
MEDIUM
PREREQUISITES:
String KMP
PROBLEM:
Given a sentence “S” and a word “s”. Need to find how many times word “s” occurs as a substring of “S”.
QUICK EXPLANATION:
This is straight forward KMP problem . One tricky thing is that one has to remove spaces from first string first . One can learn KMP from this video.
AUTHOR’S SOLUTIONS:
Author’s solution can be found here.