Finding a Motif in DNA (Exact Matching)

Foundational Motif Substring Search
Significance:
Searching for exact motifs is how you'd locate a known transcription factor binding site, a restriction enzyme site, or a primer-binding region within a longer sequence. It also introduces the concept of **overlapping matches**, which trips up naive implementations that use non-overlapping string search functions.
Statement

Given a DNA string `s` and a shorter motif string `t`, find **every** starting position (1-based indexing, as is convention in bioinformatics/ROSALIND-style problems) at which `t` appears as a substring of `s`. Matches may overlap.

Sample Input
GATATATGCATATACTT
ATAT
Sample Output
2 4 10
Constraints

- `1 ≤ length(s) ≤ 1000`, `1 ≤ length(t) ≤ length(s)`


My Notes
Log in to save personal notes.
Console output will appear here when you click Run Code or Submit...
Enter DNA / RNA / Protein test string
Next Problem
Restriction-Site Palindrome Checker