#C3311. DNA Motif Finder

    ID: 46725 Type: Default 1000ms 256MiB

DNA Motif Finder

DNA Motif Finder

Given a DNA sequence and a nucleotide motif, your task is to find all occurrences of the motif in the sequence.

An occurrence is defined as the starting index (0-indexed) where the motif appears in the sequence. If the motif does not occur, print an empty line.

The matching must be exact and overlapping occurrences are allowed.

inputFormat

The input consists of two lines:

  • The first line is a non-empty string representing the DNA sequence.
  • The second line is a non-empty string representing the nucleotide motif to search for.

outputFormat

Output the starting indices of all occurrences of the motif in the DNA sequence separated by a single space. If there are no occurrences, output an empty line.

## sample
ATCGATCG
CGA
2