Simple 2D rubiks cube algorithm.

I'm trying to write a program that transforms a user given pattern into a standard pattern as follows:

Standard:

1 2 3 4

8 7 6 5

(imagine each number as a different colored square on a board.)

There's three different transform operations that can be made:

A = Switch rows,

B = Rotate each row right one step,

C = Rotate the mid four "squares/numbers" clockwise one step.

So, if the user enters "2 6 8 4 5 7 3 1", the starting position becomes;

2 6 8 4

1 3 7 5

from which the computer program attempts to transform it into the standard form. In this case, the moves required are: BCABCCB.

Now, the issue for me is not to write it in C, but rather to come up with a suitable algorithm for solving the puzzle. I've tried a few methods but they didn't work, so I'm hoping someone could perhaps give me a hint?

Thanks in advance.