def find_all_match(txt, pat):
    n = len(txt)
    m = len(pat)

    if  m == 0:
        return 0
    

    for i in range( n - m + 1):
        j = 0

        while j < m and txt[i + j] == pat[j]:
            j +=1

        if j == m:
            return i

    return -1
    

print(find_all_match("hola mundo", "mundo"))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: