manual_find(s, sub) that returns the index of the first occurrence of sub in s, or -1 if absent — but implemented by manually comparing slices in a loop, without using str.find(), str.index(), or the in operator.s = 'hello world', sub = 'world'
6
Sliding a window of len('world') across s, the match starts at index 6.
s = 'abc', sub = 'xyz'
-1
No window of s equals sub.
Slide a window of length len(sub) across every valid starting index of s.
At each position compare s[i:i+len(sub)] to sub.