Algorithm
This algorithm is a two step process.First we create a auxiliary array lps[] and then use this array for searching the pattern.
Preprocessing :
We pre-process the pattern and create an auxiliary array lps[] which
is used to skip characters while matching.
Here lps[] indicates longes...