Recall that a string (genomic sequence) can be split in words of length 3 (codons) by sliding a window of size 3 over the string, with a step size of 3. More in general, a string can be split in overlapping words of length and overlap size by sliding a window of size and step size over the string. For example, sliding a window of size 3 and step size 2 over the string TATAAT gives the overlapping words TAT and TAA.
Write code for the sliding window problem. The program must implement and use the SLIDING-WINDOW function in the pseudocode discussed in class, which is recursive and is not allowed to perform input/output operations. Make one submission with Python code and another submission with C++ code.
The input is a string (a genomic sequence) over the alphabet , an integer (the window size), and an integer (the step size).
The output is all substrings of of size starting at positions
Notice that there are no “partial” substrings of (of size smaller than ) in the output.
Input
ACGGTAGACCT 3 1
Output
ACG CGG GGT GTA TAG AGA GAC ACC CCT
Input
ACGGTAGACCT 3 3
Output
ACG GTA GAC
Input
ACGGTAGACCT 3 5
Output
ACG AGA
Input
ACGGTAGACCT 5 2
Output
ACGGT GGTAG TAGAC GACCT