def search1(pat: str, txt: str):
    M = len(pat)
    N = len(txt)
    for i in range(N - M + 1):
        j = 0
        while j < M:
            if txt[i + j] == pat[j]:  # index should be i + j for txt
                j += 1
            else:
                break
        if j == M:
            return i
    return N


def search2(pat: str, txt: str):
    M = len(pat)
    N = len(txt)
    i = 0
    while i < N:
        j = 0
        while j < M:
            if txt[i] == pat[j]:
                i += 1
                j += 1
            else:
                i -= j
                break
        if j == M:
            return i - M
        i += 1
    return N

2d153ca5eaaeee8967763eefb94eef1c91e5b72d
<mask token>

<mask token>


def search2(pat: str, txt: str):
    M = len(pat)
    N = len(txt)
    i = 0
    while i < N:
        j = 0
        while j < M:
            if txt[i] == pat[j]:
                i += 1
                j += 1
            else:
                i -= j
                break
        if j == M:
            return i - M
        i += 1
    return N

def search1(pat: str, txt: str):
    M = len(pat)
    N = len(txt)
    for i in range(N - M + 1):
        j = 0
        while j < M:
            if txt[i + j] == pat[j]:
                j += 1
            else:
                break
        if j == M:
            return i
    return N


def search2(pat: str, txt: str):
    M = len(pat)
    N = len(txt)
    i = 0
    while i < N:
        j = 0
        while j < M:
            if txt[i] == pat[j]:
                i += 1
                j += 1
            else:
                i -= j
                break
        if j == M:
            return i - M
        i += 1
    return N

def search1(pat: str, txt: str):
    M = len(pat)
    N = len(txt)
    for i in range(N - M + 1):
        j = 0
        while j < M:
            if txt[i + j] == pat[j]:  # index should be i + j for txt
                j += 1
            else:
                break
        if j == M:
            return i
    return N


def search2(pat: str, txt: str):
    M = len(pat)
    N = len(txt)
    i = 0
    while i < N:
        j = 0
        while j < M:
            if txt[i] == pat[j]:
                i += 1
                j += 1
            else:
                i -= j
                break
        if j == M:
            return i - M
        i += 1
    return N
