Problem:
サイコロが以下の図のような向きで置かれている．

ここで使用するサイコロは，この図のように，上側に 1，南側に 2 があるときは，東側に 3 があるものとする．サイコロの向かいあう面の和は必ず 7 なので，見えない面はそれぞれ北側 5，西側 4，下側 6 になっている．

　この初期配置の状態から指示に従ってサイコロを動かしていく．ただし，指示は以下の 6 通りの操作を何回か行うものである．

North，East，South，West の各操作は指示された方向へサイコロを 90 度回転させる．
　Right，Left の 2 つの操作は上下の面はそのままで水平方向に 90 度回転させる．（回転させる向きに要注意．）

　初期配置で上の面に出ている目 1 を初期値とし， 1 回の操作が終わるたびに，上の面に出ている目の数を加算していき，指示にしたがってすべての操作を終えたときの合計値を出力するプログラムを作成しなさい.

　入力ファイルの 1 行目には総指示回数 n が書かれていて，続く n 行の各行には「North，East，South，West，Right，Left」のいずれか 1 つの指示が書かれているものとする．ただし， n ≦ 10000 とする．

入力例１

入力例２

5

8

North

West

North

North

East

Left

South

South

West

Right

North

Left

East

　

出力例１

出力例２

21

34

入力

入力は複数のデータセットからなる．n が 0 のとき入力が終了する．データセットの数は 5 を超えない．

出力

データセットごとに、合計値を１行に出力する．

入力例

5
North
North
East
South
West
8
West
North
Left
South
Right
North
Left
East
0

出力例

21
34

各データセットの出力（合計値）の後に改行を入れること。

上記問題文と自動審判に使われるデータは、情報オリンピック日本委員会が作成し公開している問題文と採点用テストデータです。

Solution in C# (judge verdict: Accepted)

using System;
using System.Collections.Generic;


namespace Dice
{
	class Program
	{
		static int Main ( string[] args )
		{
			while (true)
			{
				//??\???
				int orderCount = int.Parse (Console.ReadLine ().Trim ());

				if (orderCount == 0)
				{
					break;
				}

				string[] inputOrder = new string[orderCount];
				for (int lp = 0; lp < inputOrder.Length; lp++)
				{
					inputOrder[lp] = Console.ReadLine ().Trim ();
				}

				//??????
				Dice dice = new Dice ();
				int sum = 1;

				foreach (var item in inputOrder)
				{
					dice.Move (item);
					sum += dice.GetCenterValue ();
				}

				//??????
				Console.WriteLine (sum);

			}

			return 0;
		}

		class Dice
		{
			public Dice ()
			{
				this.Spot = new int[6];

				this.Spot[GetSpotNameValue (SpotName.North)] = 5;		//North
				this.Spot[GetSpotNameValue (SpotName.West)] = 4;		//West
				this.Spot[GetSpotNameValue (SpotName.Center)] = 1;		//Center
				this.Spot[GetSpotNameValue (SpotName.East)] = 3;		//East
				this.Spot[GetSpotNameValue (SpotName.South)] = 2;		//South
				this.Spot[GetSpotNameValue (SpotName.Temporary)] = 6;	//Back

				/* image
				 *	  5
				 *	4 1 3
				 *	  2
				 * tmp 6	
				 * 
				*/
			}

			private int[] Spot { set; get; }	//	????????????????????????????????°???????????????????´???????

			private enum SpotName : int
			{
				North = 0, West, Center, East, South, Temporary
			}
			//enum??????????????????????????????????????????????????°??????
			private int GetSpotNameValue ( SpotName spotName )
			{
				return (int) spotName;
			}
			//Center???????????°????????????
			public int GetCenterValue ()
			{
				return Spot[GetSpotNameValue (SpotName.Center)];
			}

			//?????°????????????????????????????????????
			public void Move ( string order )
			{
				switch (order)
				{
					case "North": MoveNorth (); break;
					case "West": MoveWest (); break;
					case "East": MoveEast (); break;
					case "South": MoveSouth (); break;
					case "Right": MoveRight (); break;
					case "Left": MoveLeft (); break;
					default: Console.WriteLine ("Error"); break;
				}
			}
			//????????????????§?????????????
			private void MoveNorth ()
			{
				int tmp = Spot[GetSpotNameValue (SpotName.North)];
				Spot[GetSpotNameValue (SpotName.North)] = Spot[GetSpotNameValue (SpotName.Center)];
				Spot[GetSpotNameValue (SpotName.Center)] = Spot[GetSpotNameValue (SpotName.South)];
				Spot[GetSpotNameValue (SpotName.South)] = Spot[GetSpotNameValue (SpotName.Temporary)];
				Spot[GetSpotNameValue (SpotName.Temporary)] = tmp;
			}
			private void MoveWest ()
			{
				int tmp = Spot[GetSpotNameValue (SpotName.West)];
				Spot[GetSpotNameValue (SpotName.West)] = Spot[GetSpotNameValue (SpotName.Center)];
				Spot[GetSpotNameValue (SpotName.Center)] = Spot[GetSpotNameValue (SpotName.East)];
				Spot[GetSpotNameValue (SpotName.East)] = Spot[GetSpotNameValue (SpotName.Temporary)];
				Spot[GetSpotNameValue (SpotName.Temporary)] = tmp;
			}
			private void MoveEast ()
			{
				int tmp = Spot[GetSpotNameValue (SpotName.East)];
				Spot[GetSpotNameValue (SpotName.East)] = Spot[GetSpotNameValue (SpotName.Center)];
				Spot[GetSpotNameValue (SpotName.Center)] = Spot[GetSpotNameValue (SpotName.West)];
				Spot[GetSpotNameValue (SpotName.West)] = Spot[GetSpotNameValue (SpotName.Temporary)];
				Spot[GetSpotNameValue (SpotName.Temporary)] = tmp;
			}
			private void MoveSouth ()
			{
				int tmp = Spot[GetSpotNameValue (SpotName.South)];
				Spot[GetSpotNameValue (SpotName.South)] = Spot[GetSpotNameValue (SpotName.Center)];
				Spot[GetSpotNameValue (SpotName.Center)] = Spot[GetSpotNameValue (SpotName.North)];
				Spot[GetSpotNameValue (SpotName.North)] = Spot[GetSpotNameValue (SpotName.Temporary)];
				Spot[GetSpotNameValue (SpotName.Temporary)] = tmp;
			}
			//???????????????????¨???????????????¢?????????
			private void MoveRight ()
			{
				int tmp = Spot[GetSpotNameValue (SpotName.North)];
				Spot[GetSpotNameValue (SpotName.North)] = Spot[GetSpotNameValue (SpotName.West)];
				Spot[GetSpotNameValue (SpotName.West)] = Spot[GetSpotNameValue (SpotName.South)];
				Spot[GetSpotNameValue (SpotName.South)] = Spot[GetSpotNameValue (SpotName.East)];
				Spot[GetSpotNameValue (SpotName.East)] = tmp;
			}
			//??????????????????????¨???????????????¢?????????
			private void MoveLeft ()
			{

				int tmp = Spot[GetSpotNameValue (SpotName.North)];
				Spot[GetSpotNameValue (SpotName.North)] = Spot[GetSpotNameValue (SpotName.East)];
				Spot[GetSpotNameValue (SpotName.East)] = Spot[GetSpotNameValue (SpotName.South)];
				Spot[GetSpotNameValue (SpotName.South)] = Spot[GetSpotNameValue (SpotName.West)];
				Spot[GetSpotNameValue (SpotName.West)] = tmp;
			}
		}
	}
}