Here is a simple algorithm. Split the sequence of words in sequence of k words, at every word, one by line. For your example, we have:
a b a b a
b a b a c
a b a c d
b a c d e
a c d e f
c d e f a
d e f a b
e f a b a
f a b a b
a b a b a
b a b a c
a b a c c
b a c c b
a c c b c
c c b c b
c b c b a
b c b a b
c b a b c
c b a b c
Sort them:
a b a b a
a b a b a
a b a c c
a b a c d
a c c b c
a c d e f
b a b a c
b a b a c
b a c c b
b a c d e
b c b a b
c b a b c
c b a b c
c b c b a
c c b c b
c d e f a
d e f a b
e f a b a
f a b a b
It is now easy to find the k-sequence that is the most common. If the file is very large, you may have to split it, sort the parts, and then merge the parts.