What does this definition of contiguous subsequences mean?
I'm working in a problem but I don't understand how contiguous subsequences works. For example,
Finding all 3 character length substrings in a string
public class Subsequences {
public static void main(String[] args) {
String s = "CCAATA CCGT";
String ss = s.replaceAll("\\s+","");
int n = 4; // subsequences of length
for (int i=0; i <= ss.length() - n; i++) {
String substr = ss.substring(i, i + n);
if (substr.matches("[a-zA-Z]+")) {
System.out.println(substr);
}
}
}
}
Output:
CCAA CAAT AATA ATAC TACC ACCG CCGT
Would anyone explain to me what this loop do?
for (int i=0; i <= ss.length() - n; i++) {
String substr = ss.substring(i, i + n);
if (substr.matches("[a-zA-Z]+")) {
System.out.println(substr);
}
}