Problem Usually if you are asked to find out substring based on one string pattern in another string, it means you have to check all possible substring in one string, so you should maintain a sliding window to check each substring candidate. Thought For convenience, I call two strings as pattern string and explore string. …