Possible Duplicate:
What is the fastest substring search algorithm?
How do I check if a string is present in a bigger string of length of 100,000 characters in C++ or Java?
I know a method str.find("sub_string"); but it can’t handle such a big string.
The max execution time is 1 sec.
Also the sub strings I need to look for can be 50,000!
This completes almost instantly (4ms) on my modest 1st gen Intel iMac. I put the search string between two blocks of 100,000 characters in case java searches backwards.
Output