pattern matching



Dear list members:

I'm facing the following problem:
given a two lists, for example, [a,b,c,x,a] and [z,a,a,b]
I'm interested in finding the largest sequence of symbols that match
both lists, considering lists as circular, i.e.,
[z,a,a,b]=[a,a,b,z]=[a,b,z,a]=[b,z,a,a].
In the above example, the sequence "a,b" appears in both lists, but I
would be interested in finding the sequence "a,a,b" which is the
longest one to appear in both lists (considering the lists as
circular).

Any idea on how to find such common patterns ?
Thanks.
Paulo


Paulo Gustavo Grahl, CFA
------------------------------------------
pgrahl at gmail.com
pgrahl at fgvmail.br
+55(21) 8809-9254
www.linkedin.com/in/pgrahl
------------------------------------------