public static int[][] transpose(int[][] A, string D)
int[][] B = new int[3][];
for (int i = 0; i < 3; i++)
B[i] = new int[]{0, 0, 0};
for (int j = 0; j < 3; j++)
Console.WriteLine("Direction input ERROR");
public static void front(int[][] F, int[][] L, int[][] U, int[][] R, int[][] D)
int[][] F_ = new int[3][];
int[] U_ = new int[]{L[2][2], L[1][2], L[0][2]};
int[] R_ = new int[]{U[2][0], U[2][1], U[2][2]};
int[] D_ = new int[]{R[0][0], R[1][0], R[2][0]};
for (int i = 0; i < 3; i++)
F_[i] = new int[]{0, 0, 0};
for (int j = 0; j < 3; j++)
Array.Copy(F_, F, F.Length);
public static void left(int[][] L, int[][] B, int[][] U, int[][] F, int[][] D)
int[][] U_ = transpose(U, "CCW");
int[][] D_ = transpose(D, "CCW");
public static void back(int[][] B, int[][] R, int[][] U, int[][] L, int[][] D)
int[][] U_ = transpose(transpose(U, "CW"), "CW");
int[][] D_ = transpose(transpose(D, "CW"), "CW");
U_ = transpose(transpose(U_, "CW"), "CW");
D_ = transpose(transpose(D_, "CW"), "CW");
Array.Copy(U_, U, U.Length);
Array.Copy(D_, D, D.Length);
public static void right(int[][] R, int[][] F, int[][] U, int[][] B, int[][] D)
int[][] U_ = transpose(U, "CW");
int[][] D_ = transpose(D, "CW");
U_ = transpose(U_, "CCW");
D_ = transpose(D_, "CCW");
Array.Copy(U_, U, U.Length);
Array.Copy(D_, D, D.Length);
public static void up(int[][] U, int[][] L, int[][] B, int[][] R, int[][] F)
int[][] L_ = transpose(L, "CW");
int[][] B_ = transpose(transpose(B, "CW"), "CW");
int[][] R_ = transpose(R, "CCW");
L_ = transpose(L_, "CCW");
B_ = transpose(transpose(B_, "CW"), "CW");
R_ = transpose(R_, "CW");
Array.Copy(L_, L, L.Length);
Array.Copy(B_, B, B.Length);
Array.Copy(R_, R, R.Length);
public static void down(int[][] D, int[][] L, int[][] B, int[][] R, int[][] F)
int[][] L_ = transpose(L, "CCW");
int[][] B_ = transpose(transpose(B, "CW"), "CW");
int[][] R_ = transpose(R, "CW");
L_ = transpose(L_, "CW");
B_ = transpose(transpose(B_, "CW"), "CW");
R_ = transpose(R_, "CCW");
Array.Copy(L_, L, L.Length);
Array.Copy(B_, B, B.Length);
Array.Copy(R_, R, R.Length);
public static void action(string[] input, int[][] F, int[][] U, int[][] L, int[][] R, int[][] D, int[][] B)
foreach (string s in input)
Console.WriteLine("Input error");
public static void final(int[][] F, int[][] U, int[][] L, int[][] R, int[][] D, int[][] B)
string[] ans = new string[9];
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
foreach (string a in ans)
public static void Main()
int[][] F = new int[3][];
int[][] U = new int[3][];
int[][] L = new int[3][];
int[][] R = new int[3][];
int[][] D = new int[3][];
int[][] B = new int[3][];
for (int i = F.Length - 1; i >= 0; i--)
U[i] = new int[]{0, 0, 0};
L[i] = new int[]{0, 0, 0};
R[i] = new int[]{0, 0, 0};
D[i] = new int[]{0, 0, 0};
B[i] = new int[]{0, 0, 0};
F[i] = new int[]{x, x + 1, x + 2};
string ins = "L U F B B";
string[] input = ins.Split(' ');
public static void print(int[][] S)
for (int i = 0; i < S.Length; i++)
for (int j = 0; j < S[i].Length; j++)
Console.Write(S[i][j] + " ");