PHP Code:
function findpatterns(str) {
temp.loc = 0;
temp.l = temp.str.length();
temp.results = new[0];
while (temp.loc < temp.l) {
temp.len = 2;
while (temp.len <= (temp.l - temp.loc)) {
temp.seq = temp.str.substring(temp.loc, temp.len);
temp.("count_" @ temp.seq)++;
if (temp.("count_" @ temp.seq) == 2) {
temp.results.add(temp.seq);
}
temp.len++;
}
temp.loc++;
}
for (temp.r: temp.results) {
echo(temp.r @ ": " @ temp.("count_" @ temp.r));
}
}