Hi, I’m trying to solve this problem (https://www.spoj.com/problems/BLHETA/). In this problem, a string s and a sequence of patterns (speels) P are given. And I need to write a program to find all occurrences of the patterns (in the order that it appear in P) in the string s and remove then from the string.
I coded a program, but this program is resulting in TLE. My actual solution has complexity O (m . n . MAX), where m = |s|, n = |P|, and MAX = max |p| (\forall p \in P). And I’d like to know if anyone may give me a tip to solve this problem.
Bellow follow my code.
Thank you.