use two unix commands to solve the following problem

Hi, all,

The following commands could compute the 10 most frequent bigrams from a input sequence which is in a file infile.

I would like to know whether there is somebody who can use only two unix commands to do the same work.

--------------------
tr " " "\012*" <infile >out1
tail +2 out1 > out1.new
paste out1 out1.new|sort |uniq -c|sort -r|head -10
--------------------

Thanks in advance.

Sample i/p and o/p would be appreciated.

input file contains
d a t a b a s e s t o r e s d a t a

output

2 t a
2 e s
2 d a
2 a t
1 t o
1 s t
1 s e
1 s d
1 r e
1 o r

Homework questions are not permitted.

Thread closed.