https en wikipedia orgwikistringsearchingalgorithmnac3afvestringsearch this algorithm tries to find the pattern from every position of the mainstring if pattern is found from position i it add it to the answer and does the same for position i1 complexity onm nlength of main string mlength of pattern string naivepatternsearchabaaabcdbbabcddebcabc abc 4 10 18 naivepatternsearchabc abaaabcdbbabcddebcabc naivepatternsearch abc naivepatternsearchtest test 0 naivepatternsearchabcdegftest test 7 naive_pattern_search abaaabcdbbabcddebcabc abc 4 10 18 naive_pattern_search abc abaaabcdbbabcddebcabc naive_pattern_search abc naive_pattern_search test test 0 naive_pattern_search abcdegftest test 7
def naive_pattern_search(s: str, pattern: str) -> list:
    
    pat_len = len(pattern)
    position = []
    for i in range(len(s) - pat_len + 1):
        match_found = True
        for j in range(pat_len):
            if s[i + j] != pattern[j]:
                match_found = False
                break
        if match_found:
            position.append(i)
    return position


if __name__ == "__main__":
    assert naive_pattern_search("ABCDEFG", "DE") == [3]
    print(naive_pattern_search("ABAAABCDBBABCDDEBCABC", "ABC"))