Step 1: Check pattern starting at text index 0
text: a[0] b c x a b c d
pattern: a b c d
compare text[0] and pattern[0]
Why: Start matching pattern from the first character of text
Step 2: Compare text[1] and pattern[1]
text: a b[1] c x a b c d
pattern: a b c d
matched 'a' and 'b' so far
Why: Continue matching next characters
Step 3: Compare text[2] and pattern[2]
text: a b c[2] x a b c d
pattern: a b c d
matched 'a','b','c' so far
Why: Continue matching next characters
Step 4: Compare text[3] and pattern[3]
text: a b c x[3] a b c d
pattern: a b c d
text[3] is 'x' but pattern[3] is 'd' - mismatch
Why: Mismatch found, stop matching here
Step 5: Shift pattern start to text index 1 and compare
text: a b c x a b c d
pattern: a b c d
compare text[1] and pattern[0]
Why: Try matching pattern starting at next text position
Step 6: Compare text[1] and pattern[0]
text: a b[1] c x a b c d
pattern: a b c d
text[1] is 'b' but pattern[0] is 'a' - mismatch
Why: Mismatch at first character, move to next position
Step 7: Shift pattern start to text index 2 and compare
text: a b c x a b c d
pattern: a b c d
compare text[2] and pattern[0]
Why: Try matching pattern starting at next text position
Step 8: Compare text[2] and pattern[0]
text: a b c[2] x a b c d
pattern: a b c d
text[2] is 'c' but pattern[0] is 'a' - mismatch
Why: Mismatch at first character, move to next position
Step 9: Shift pattern start to text index 3 and compare
text: a b c x a b c d
pattern: a b c d
compare text[3] and pattern[0]
Why: Try matching pattern starting at next text position
Step 10: Compare text[3] and pattern[0]
text: a b c x[3] a b c d
pattern: a b c d
text[3] is 'x' but pattern[0] is 'a' - mismatch
Why: Mismatch at first character, move to next position
Step 11: Shift pattern start to text index 4 and compare
text: a b c x a b c d
pattern: a b c d
compare text[4] and pattern[0]
Why: Try matching pattern starting at next text position
Step 12: Compare text[4] and pattern[0]
text: a b c x a[4] b c d
pattern: a b c d
matched 'a'
Why: First character matches, continue
Step 13: Compare text[5] and pattern[1]
text: a b c x a b[5] c d
pattern: a b c d
matched 'a','b'
Why: Continue matching next characters
Step 14: Compare text[6] and pattern[2]
text: a b c x a b c[6] d
pattern: a b c d
matched 'a','b','c'
Why: Continue matching next characters
Step 15: Compare text[7] and pattern[3]
text: a b c x a b c d[7]
pattern: a b c d
matched full pattern
Why: Full pattern matched, stop
Result: text: a b c x a b c d
pattern: a b c d
Pattern found starting at index 4