Write 2 programs in the same language which count the number of shared subsequences of consecutive elements from 2 given sequences.
For example, given
"enter", there are 5 shared subsequences of consecutive elements:
t t e e te
One possible algorithm consists in counting, for each subsequence of consecutive elements of one sequence, the number of times it appears in the list of subsequences of the other one.
In our previous example, for
"t" appears once in
"e" appears twice,
"t" appears once, and
"te" appears once; therefore we get 5 as output. (it does not matter if you pick
"enter" as the "first" sequence).
Your score will be the result of one of your programs, when given your 2 programs as input. That is, the number of shared subsequences of consecutive elements between both programs.
Lowest score wins. In case of a tie, the lowest byte count of the sum of your 2 programs wins.
Both sequences will have at least 1 element.
The two input sequences can either be strings, or lists of chars, or lists of numbers, or any other fitting format for your language.
For example, if you take lists of numbers as inputs, your will transform your programs as lists of char codes according to your language’s code page.
a, b -> 0 test, enter -> 5 hello, hello -> 17 yes, yeyeyeah -> 9