A restriction site is a sequence of DNA that can be recognized and cut by a specific restriction enzyme. Palindromic sequences are typical restriction sites because they read the same forward and backward. The goal is to identify all restriction sites (palindromic sequences) of length between 4 and 12 in a DNA string.
Write a program to locate all palindromic sequences of length between 4 and 12 in the given DNA string. Return the positions and lengths of these palindromic sequences in the format: position length
.
Sample Input:
TCAATGCATGCGGGTCTATATGCAT
Sample Output:
4 6 5 4 6 6 7 4 17 4 18 4 20 6 21 4
Constraints:
The DNA string will contain at most 1,000 nucleotides.
Explanation:
The sample input contains several palindromic sequences. The output lists the positions and lengths of these sequences.