Problem:


  MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Dice I

  Write a program to simulate rolling a dice, which can be constructed by the following net.

  As shown in the figures, each face is identified by a different label from 1 to 6.

  Write a program which reads integers assigned to each face identified by the label and a sequence of commands to roll the dice, and prints the integer on the top face. At the initial state, the dice is located as shown in the above figures.

Input

  In the first line, six integers assigned to faces are given in ascending order of their corresponding labels.

  In the second line, a string which represents a sequence of commands, is given. The command is one of 'E', 'N', 'S' and 'W' representing four directions shown in the above figures.

Output

  Print the integer which appears on the top face after the simulation.

Constraints

$0 \leq $ the integer assigned to a face $ \leq 100$

$0 \leq $ the length of the command $\leq 100$

Sample Input 1

1 2 4 8 16 32
SE

Sample Output 1

8

You are given a dice where 1, 2, 4, 8, 16 are 32 are assigned to a face labeled by 1, 2, ..., 6 respectively. After you roll the dice to the direction S and then to the direction E, you can see 8 on the top face.

Sample Input 2

1 2 4 8 16 32
EESWN

Sample Output 2

32



Sample input:
1 2 4 8 16 32
SE


Sample output:
8

Submission status: Wrong Answer

Solution code:
Dice=[[4, 2, 5, 3],[4,6,1,3],[2,6,1,5],[5,6,1,2],[3,6,1,4],[4,5,2,3]]

L = list(map(int, input().split()))
DiceRoll = str(input())
n = 1
for i in DiceRoll:
 if i == "E":
  n = Dice[n-1][0]
 elif i == "N":
  n = Dice[n-1][1]
 elif i == "S":
  n = Dice[n-1][2]
 else:
  n = Dice[n-1][3]
print(str(L[n-1]))

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, n):
        self.i = 0
        self.n_up = n[self.i]
        self.dice_N = (1, 5, 5, 0, 0, 4)
        self.dice_S = (4, 0, 0, 5, 5, 1)
        self.dice_E = (3, 3, 1, 1, 3, 3)
        self.dice_W = (2, 2, 4, 4, 2, 2)

    def move(self, dice_dir):
        for d in dice_dir:
            if d == "N":
                n_up = n[self.dice_N[self.i]]
                self.i = self.dice_N[self.i]

            if d == "S":
                n_up = n[self.dice_S[self.i]]
                self.i = self.dice_S[self.i]

            if d == "E":
                n_up = n[self.dice_E[self.i]]
                self.i = self.dice_E[self.i]

            if d == "W":
                n_up = n[self.dice_W[self.i]]
                self.i = self.dice_W[self.i]

        return n_up

n = list(map(int, input().split()))
dice = Dice(n)

dice_dir = list(input())
n_up = dice.move(dice_dir)

print(n_up)

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, labels):
        self.labels = labels
    def east(self):
        self.labels[0], self.labels[2], self.labels[3], self.labels[5] = self.labels[3], self.labels[0], self.labels[5], self.labels[2]
    def west(self):
        self.labels[0], self.labels[2], self.labels[3], self.labels[5] = self.labels[2], self.labels[5], self.labels[0], self.labels[3]
    def north(self):
        self.labels[0], self.labels[1], self.labels[4], self.labels[5] = self.labels[1], self.labels[5], self.labels[0], self.labels[4]
    def south(self):
        self.labels[0], self.labels[1], self.labels[4], self.labels[5] = self.labels[4], self.labels[0], self.labels[5], self.labels[1]

dice = Dice(list(map(int, input().split())))  
commands = input()
 
for c in commands:
  if c == 'E':
    dice.east()
  elif c == 'W':
    dice.west()
  elif c == 'N':
    dice.north
  elif c == 'S':
    dice.south
 
print(dice.labels[0])

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, labels):
        self.labels = labels
    def east(self):
        self.labels[0], self.labels[2], self.labels[3], self.labels[5] = self.labels[3], self.labels[0], self.labels[5], self.labels[2]
    def west(self):
        self.labels[0], self.labels[2], self.labels[3], self.labels[5] = self.labels[2], self.labels[5], self.labels[0], self.labels[3]
    def north(self):
        self.labels[0], self.labels[1], self.labels[4], self.labels[5] = self.labels[1], self.labels[5], self.labels[0], self.labels[4]
    def south(self):
        self.labels[0], self.labels[1], self.labels[4], self.labels[5] = self.labels[4], self.labels[0], self.labels[5], self.labels[1]

dice = Dice(list(map(int, input().split())))
commands = input()

for c in commands:
  if c == 'E':
    dice.east()
  elif c == 'W':
    dice.west()
  elif c == 'N':
    dice.north()
  elif c == 'S':
    dice.south()

print(dice.labels[1])

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, labels):
        self.labels = labels
    def east(self):
        self.labels[1], self.labels[2], self.labels[3], self.labels[4] = self.labels[3], self.labels[1], self.labels[4], self.labels[2]
    def west(self):
        self.labels[1], self.labels[2], self.labels[3], self.labels[4] = self.labels[2], self.labels[4], self.labels[1], self.labels[3]
    def north(self):
        self.labels[0], self.labels[1], self.labels[4], self.labels[5] = self.labels[1], self.labels[5], self.labels[0], self.labels[4]
    def south(self):
        self.labels[0], self.labels[1], self.labels[4], self.labels[5] = self.labels[4], self.labels[0], self.labels[5], self.labels[1]

dice = Dice(list(map(int, input().split())))
commands = input()

for c in commands:
  if c == 'E':
    dice.east()
  elif c == 'W':
    dice.west()
  elif c == 'N':
    dice.north()
  elif c == 'S':
    dice.south()

print(dice.labels[1])

Submission status: Wrong Answer

Solution code:
EW=[1,3,6,4]
NS=[1,2,6,5]

s=raw_input().split()
m=raw_input()

m=m[::-1]
c=1
for i in m:
    if i=="E":
        if c not in EW:
            continue
        a=EW.index(c)
        c=EW[(a+3)%4]
    elif i=="N":
        if c not in NS:
            continue
        a=NS.index(c)
        c=EW[(a+3)%4]
    elif i=="S":
        if c not in NS:
            continue
        a=NS.index(c)
        c=EW[(a+1)%4]
    elif i=="W":
        if c not in EW:
            continue
        a=EW.index(c)
        c=EW[(a+1)%4]

print s[c-1]

Submission status: Wrong Answer

Solution code:
x=[int(i)for i in input().split()]
y=[[int(0)for i in range(4)]for i in range(3)]
y[0][1]=x[0]
y[1][1]=x[1]
y[1][2]=x[2]
y[1][0]=x[3]
y[1][3]=x[4]
y[2][1]=x[5]
m=[i for i in input()]
z=y.copy()
for i in range(len(m)):
    if m[i]=='N':
        y[0][1],z[1][1]=z[1][1],y[0][1]
        y[1][1],z[2][1]=z[2][1],y[1][1]
        y[1][3],z[0][1]=z[0][1],y[1][3]
        y[2][1],z[1][3]=z[1][3],y[2][1]
        z=y.copy()
    elif m[i]=='S':
        y[0][1],z[1][3]=z[1][3],y[0][1]
        y[1][1],z[0][1]=z[0][1],y[1][1]
        y[1][3],z[2][1]=z[2][1],y[1][3]
        y[2][1],z[1][1]=z[1][1],y[2][1]
        z=y.copy()
    elif m[i]=='W':
        y[0][1],z[1][2]=z[1][2],y[0][1]
        y[1][0],z[0][1]=z[0][1],y[1][0]
        y[1][2],z[2][1]=z[2][1],y[1][2]
        y[2][1],z[1][0]=z[1][0],y[2][1]
        z=y.copy()
    else:
        y[0][1],z[1][0]=z[1][0],y[0][1]
        y[1][0],z[2][1]=z[2][1],y[1][0]
        y[1][2],z[0][1]=z[0][1],y[1][2]
        y[2][1],z[1][2]=z[1][2],y[2][1]
        z=y.copy()
print(y[0][1])

Submission status: Wrong Answer

Solution code:
x=[int(i)for i in input().split()]
y=[[int(0)for i in range(4)]for i in range(3)]
y[0][1]=x[0]
y[1][1]=x[1]
y[1][2]=x[2]
y[1][0]=x[3]
y[1][3]=x[4]
y[2][1]=x[5]
m=[i for i in input()]
for i in range(len(m)):
    if m[i]=='N':
        y[0][1],y[1][1]=y[1][1],y[0][1]
        y[1][1],y[2][1]=y[2][1],y[1][1]
        y[2][1],y[1][3]=y[1][3],y[2][1]
    elif m[i]=='S':
        y[0][1],y[1][3]=y[1][3],y[0][1]
        y[1][3],y[2][1]=y[2][1],y[1][3]
        y[2][1],y[1][1]=y[1][1],y[2][1]
        print(y)
    elif m[i]=='W':
        y[0][1],y[1][2]=y[1][2],y[0][1]
        y[1][2],y[2][1]=y[2][1],y[1][2]
        y[2][1],y[1][0]=y[1][0],y[2][1]
    elif m[i]=='E':
        y[0][1],y[1][0]=y[1][0],y[0][1]
        y[1][0],y[2][1]=y[2][1],y[1][0]
        y[2][1],y[1][2]=y[1][2],y[2][1]
        print(y)
        z=y.copy()
print(y[0][1])

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
???????????? I

?¬?????±??????????????????????????????????????????¢??????????????\??¬????????§????????????????????°????????????????????????????????????
   +--+
 ???|???|
+--+--+--+--+
|???|???|???|???|
+--+--+--+--+
 ???|???|
   +--+

"""
class Dice:
    """ ????????????????????? """
    def __init__(self):                  # ?????????????????????
        self.side = [1, 2, 3, 4, 5, 6]

    def setDice(self, arr):  # ??¢??????????????????
        self.side = arr[0:6]

    def Turn(self, dir):
        s = self.side

        if dir == "N":     # ????????¢??????
            t = [s[4],s[0],s[2],s[3],s[5],s[1]]
        elif dir == "S": # ????????¢??????
            t = [s[1],s[5],s[2],s[3],s[0],s[4]]
        elif dir == "E": # ??±?????¢??????
            t = [s[3],s[1],s[0],s[5],s[4],s[2]]
        elif dir == "W": # ?\??????¢??????
            t = [s[2],s[1],s[5],s[0],s[4],s[3]]

        self.side = t




num = list(map(int,input().strip().split()))
cmd = input().strip()
d = Dice()
d.setDice(num)
for c in cmd:
    d.Turn(c)
print(d.side[0])

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
???????????? I

?¬?????±??????????????????????????????????????????¢??????????????\??¬????????§????????????????????°????????????????????????????????????
   +--+
 ???|???|
+--+--+--+--+
|???|???|???|???|
+--+--+--+--+
 ???|???|
   +--+

"""
class Dice:
    """ ????????????????????? """
    def __init__(self):                  # ?????????????????????
        self.side = [1, 2, 3, 4, 5, 6]

    def setDice(self, arr):  # ??¢??????????????????
        self.side = arr[0:6]

    def Turn(self, dir):
        s = self.side

        if dir == "N":     # ????????¢??????
            t = [s[1],s[5],s[2],s[3],s[0],s[4]]
        elif dir == "S": # ????????¢??????
            t = [s[4],s[0],s[2],s[3],s[5],s[1]]
        elif dir == "E": # ??±?????¢??????
            t = [s[2],s[1],s[5],s[0],s[4],s[3]]
        elif dir == "W": # ?\??????¢??????
            t = [s[3],s[1],s[0],s[5],s[4],s[2]]

        self.side = t




num = list(map(int,input().strip().split()))
cmd = input().strip()
d = Dice()
d.setDice(num)
for c in cmd:
    d.Turn(c)
#    print("{0} {1}".format(c,d.side[0]))
print(d.side[0])

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
???????????? I

?¬?????±??????????????????????????????????????????¢??????????????\??¬????????§????????????????????°????????????????????????????????????
   +--+
 ???|???|
+--+--+--+--+
|???|???|???|???|
+--+--+--+--+
 ???|???|
   +--+

"""
class Dice:
    """ ????????????????????? """
    def __init__(self):                  # ?????????????????????
        self.side = [1, 2, 3, 4, 5, 6]

    def setDice(self, arr):  # ??¢??????????????????
        self.side = arr[0:6]

    def Turn(self, dir):
        s = self.side

        if dir == "N":     # ????????¢??????
            t = [s[1],s[5],s[2],s[3],s[0],s[4]]
        elif dir == "S": # ????????¢??????
            t = [s[4],s[0],s[2],s[3],s[5],s[1]]
        elif dir == "E": # ??±?????¢??????
            t = [s[3],s[1],s[0],s[5],s[4],s[2]]
        elif dir == "W": # ?\??????¢??????
            t = [s[2],s[1],s[5],s[0],s[4],s[3]]

        self.side = t




num = list(map(int,input().strip().split()))
cmd = input().strip()
d = Dice()
d.setDice(num)
for c in cmd:
    d.Turn(c)
    print("{0} {1}".format(c,d.side[0]))
print(d.side[0])

Submission status: Wrong Answer

Solution code:
x1,x2,x3,x4,x5,x6 = map(int,(input().split()))
t = input()
x=x1


L=[x1,x2,x3,x4,x5,x6]
n= len(t)
T=[]
M=[]
for i in range(n):
    T.append(t[:1])
    t=t[1:]
print(x1,x2,x3,x4,x5,x6)


for i in T:
    if i is "S":
        L = [L[4],L[0],L[2],L[3],L[4],L[5]]
    elif i is "E":
        L = [L[3], L[1], L[0], L[5], L[4], L[2]]
    elif i is "N":
        L = [L[1], L[5], L[2], L[3], L[0], L[4]]
    else:
        L = [L[2], L[1], L[5], L[0], L[4], L[3]]

Submission status: Wrong Answer

Solution code:
x1,x2,x3,x4,x5,x6 = map(int,(input().split()))
t = input()
x=x1


L=[x1,x2,x3,x4,x5,x6]
n= len(t)
T=[]
M=[]
for i in range(n):
    T.append(t[:1])
    t=t[1:]



for i in T:
    if i is "S":
        L = [L[4],L[0],L[2],L[3],L[4],L[5]]
    elif i is "E":
        L = [L[3], L[1], L[0], L[5], L[4], L[2]]
    elif i is "N":
        L = [L[1], L[5], L[2], L[3], L[0], L[4]]
    else:
        L = [L[2], L[1], L[5], L[0], L[4], L[3]]

Submission status: Wrong Answer

Solution code:
x1,x2,x3,x4,x5,x6 = map(int,(input().split()))
t = input()
x=x1


L=[x1,x2,x3,x4,x5,x6]
n= len(t)
T=[]
M=[]
for i in range(n):
    T.append(t[:1])
    t=t[1:]



for i in T:
    if i is "S":
        L = [L[4],L[0],L[2],L[3],L[4],L[5]]
    elif i is "E":
        L = [L[3], L[1], L[0], L[5], L[4], L[2]]
    elif i is "N":
        L = [L[1], L[5], L[2], L[3], L[0], L[4]]
    else:
        L = [L[2], L[1], L[5], L[0], L[4], L[3]]



print(L[0])

Submission status: Wrong Answer

Solution code:
class dice():
    def __init__(self,men1,men2,men3,men4,men5,men6):
        self.men=[men1,men2,men3,men4,men5,men6]
        self.current_men=1
        self.men_udlr=[5,2,4,3]
        self.move_d=0
        
    def move_dice(self,direction): 
        if direction=="E":
            s=self.men_udlr[2]
            self.men_udlr=[self.men_udlr[0],self.men_udlr[2],
                          7-self.current_men,self.current_men]
            self.current_men=s
        if direction=="N":
            s=self.men_udlr[1]
            self.men_udlr=[self.current_men,7-self.current_men
                           ,self.men_udlr[2],self.men_udlr[3]]
            self.current_men=s
        if direction=="S":
            s=self.men_udlr[0]
            self.men_udlr=[7-self.current_men,self.current_men
                           ,self.men_udlr[2],self.men_udlr[3]]
            self.current_men=s
        if direction=="W":
            s=self.men_udlr[3]
            self.men_udlr=[self.men_udlr[0],self.men_udlr[1]
                           ,self.current_men
                           ,7-self.current_men]
            self.current_men=s
        
    def show_num(self):

        return self.men[self.current_men-1]

m_n=list(map(int,input().split()))
cmd=input()
d=dice(*m_n)
for c in cmd:
    d.move_dice(c)
print(d.show_num())

Submission status: Wrong Answer

Solution code:
class Dice:
    __slots__ = ['n1', 'n2', 'n3', 'n4', 'n5', 'n6']

    def __init__(self, n_tup):

        self.n1 = n_tup[0]
        self.n2 = n_tup[1]
        self.n3 = n_tup[2]
        self.n4 = n_tup[3]
        self.n5 = n_tup[4]
        self.n6 = n_tup[5]

    def roll(self, direction):
        if direction == "N":
            self.n1, self.n2, self.n6, self.n5 \
                = self.n2, self.n6, self.n5, self.n1
        elif direction == "E":
            self.n1, self.n3, self.n6, self.n4 \
                = self.n4, self.n1, self.n3, self.n6
        if direction == "S":
            self.n1, self.n2, self.n6, self.n5 \
                = self.n5, self.n1, self.n2, self.n6
        if direction == "W":
            self.n1, self.n3, self.n6, self.n4 \
                = self.n4, self.n1, self.n3, self.n6

dice = Dice([int(x) for x in input().split()])

cmd = input()
for i in range(len(cmd)):
    dice.roll(cmd[i])

print(dice.n1)

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, one, two, three, four, five, six):
        self.upper = one
        self.one = one
        self.two = two
        self.three = three
        self.four = four
        self.five = five
        self.six = six
    def rotate(self, command):
        if command == "N":
            if self.upper == self.one or self.upper == self.three or self.upper == self.four:
                self.upper = self.two
            elif self.upper == self.two:
                self.upper = self.six
            elif self.upper == self.five:
                self.upper = self.one
            elif self.upper == self.six:
                self.upper = self.five
        elif command == "S":
            if self.upper == self.one or self.upper == self.three or self.upper == self.four:
                self.upper = self.five
            elif self.upper == self.two:
                self.upper = self.one
            elif self.upper == self.five:
                self.upper = self.six
            elif self.upper == self.six:
                self.upper = self.two
        elif command == "W":
            if self.upper == self.one or self.upper == self.two or self.upper == self.five:
                self.upper = self.three
            elif self.upper == self.three:
                self.upper = self.six
            elif self.upper == self.four:
                self.upper = self.one
            elif self.upper == self.six:
                self.upper = self.four
        elif command == "E":
            if self.upper == self.one or self.upper == self.two or self.upper == self.five:
                self.upper = self.four
            elif self.upper == self.three:
                self.upper = self.one
            elif self.upper == self.four:
                self.upper = self.six
            elif self.upper == self.six:
                self, upper = self.three
a, b, c, d, e, f = input().split()
operation = input()
A = Dice(a, b, c, d, e, f)
for i in range(len(operation)):
    A.rotate(operation[i])
print(A.upper)

Submission status: Wrong Answer

Solution code:
dice = {"top": 0, "front": 0, "right": 0, "left": 0, "back": 0, "bottom": 0}
for d, n in zip(dice, input().split()):
    dice[d] = n
command = input()
for c in command:
    if c == "E":
        t = dice["top"]
        dice["top"] = dice["left"]
        dice["left"] = dice["bottom"]
        dice["bottom"] = dice["right"]
        dice["right"] = t
    elif c == "W":
        t = dice["top"]
        dice["top"] = dice["right"]
        dice["right"] = dice["bottom"]
        dice["bottom"] = dice["left"]
        dice["left"] = t
    elif c == "S":
        t = dice["top"]
        dice["top"] = dice["back"]
        dice["back"] = dice["bottom"]
        dice["bottom"] = dice["front"]
        dice["front"] = t
    else:
        t = dice["top"]
        dice["top"] = dice["front"]
        dice["front"] = dice["bottom"]
        dice["bottom"] = dice["back"]
        dice["back"] = t
print(dice["top"])

Submission status: Wrong Answer

Solution code:
dice = {"top": 0, "front": 0, "right": 0, "left": 0, "back": 0, "bottom": 0}
for d, n in zip(dice, input().split()):
    dice[d] = n
command = input()
for c in command:
    if c == "E":
        t = dice["top"]
        dice["top"] = dice["left"]
        dice["left"] = dice["bottom"]
        dice["bottom"] = dice["right"]
        dice["right"] = t
    elif c == "W":
        t = dice["top"]
        dice["top"] = dice["right"]
        dice["right"] = dice["bottom"]
        dice["bottom"] = dice["left"]
        dice["left"] = t
    elif c == "S":
        t = dice["top"]
        dice["top"] = dice["back"]
        dice["back"] = dice["bottom"]
        dice["bottom"] = dice["front"]
        dice["front"] = t
    else:
        t = dice["top"]
        dice["top"] = dice["front"]
        dice["front"] = dice["bottom"]
        dice["bottom"] = dice["back"]
        dice["back"] = t
print(int(dice["top"]))

Submission status: Wrong Answer

Solution code:
dice = {"top": 0, "front": 0, "right": 0, "left": 0, "back": 0, "bottom": 0}
for d, n in zip(dice, input().split()):
    dice[d] = int(n)
command = input()
for c in command:
    if c == "E":
        t = dice["top"]
        dice["top"] = dice["left"]
        dice["left"] = dice["bottom"]
        dice["bottom"] = dice["right"]
        dice["right"] = t
    elif c == "W":
        t = dice["top"]
        dice["top"] = dice["right"]
        dice["right"] = dice["bottom"]
        dice["bottom"] = dice["left"]
        dice["left"] = t
    elif c == "S":
        t = dice["top"]
        dice["top"] = dice["back"]
        dice["back"] = dice["bottom"]
        dice["bottom"] = dice["front"]
        dice["front"] = t
    else:
        t = dice["top"]
        dice["top"] = dice["front"]
        dice["front"] = dice["bottom"]
        dice["bottom"] = dice["back"]
        dice["back"] = t
print(dice["top"])

Submission status: Wrong Answer

Solution code:
class Dice:
    current = 1
    num = {}
    map = {
        1:{'N':2, 'S':5, 'E':4, 'W':3},
        2:{'N':6, 'S':1, 'E':4, 'W':3},
        3:{'N':6, 'S':1, 'E':2, 'W':5},
        4:{'N':6, 'S':1, 'E':5, 'W':2},
        5:{'N':6, 'S':1, 'E':4, 'W':3},
        6:{'N':5, 'S':2, 'E':4, 'W':3},
        }
    def __init__(self, num):
        for i, v in enumerate(num):
             self.num[i+1] = v
    def move(self, direct):
        self.current = self.map[self.current][direct]
        return self.map[self.current][direct]
    def getNum(self):
        return self.num[self.current]

num = map(int, raw_input().split())
direction = list(raw_input())
a = Dice(num)
print direction
for d in direction:
    a.move(d)
print a.getNum()

Submission status: Wrong Answer

Solution code:
class Dice:
    current = 1
    num = {}
    map = {
        1:{'N':2, 'S':5, 'E':4, 'W':3},
        2:{'N':6, 'S':1, 'E':4, 'W':3},
        3:{'N':6, 'S':1, 'E':2, 'W':5},
        4:{'N':6, 'S':1, 'E':5, 'W':2},
        5:{'N':6, 'S':1, 'E':4, 'W':3},
        6:{'N':5, 'S':2, 'E':4, 'W':3},
        }
    def __init__(self, num):
        for i, v in enumerate(num):
             self.num[i+1] = v
    def move(self, direct):
        self.current = self.map[self.current][direct]
        return self.map[self.current][direct]
    def getNum(self):
        return self.num[self.current]

num = map(int, raw_input().split())
direction = list(raw_input())
a = Dice(num)
for d in direction:
    a.move(d)
print a.getNum()

Submission status: Wrong Answer

Solution code:
class Dice:
    current = 1
    num = {}
    map = {
        1:{'N':2, 'S':5, 'E':4, 'W':3},
        2:{'N':6, 'S':1, 'E':4, 'W':3},
        3:{'N':6, 'S':1, 'E':2, 'W':5},
        4:{'N':6, 'S':1, 'E':5, 'W':2},
        5:{'N':6, 'S':1, 'E':3, 'W':4},
        6:{'N':5, 'S':2, 'E':4, 'W':3},
        }
    def __init__(self, num):
        for i, v in enumerate(num):
             self.num[i+1] = v
    def move(self, direct):
        self.current = self.map[self.current][direct]
        return self.map[self.current][direct]
    def getNum(self):
        return self.num[self.current]

num = map(int, raw_input().split())
direction = raw_input()
a = Dice(num)
for d in list(direction):
    a.move(d)
print a.getNum()

Submission status: Wrong Answer

Solution code:
class Dice:
    current = 1
    num = {}
    map = {
        1:{'N':2, 'S':5, 'E':4, 'W':3},
        2:{'N':6, 'S':1, 'E':4, 'W':3},
        3:{'N':6, 'S':1, 'E':2, 'W':5},
        4:{'N':6, 'S':1, 'E':5, 'W':2},
        5:{'N':6, 'S':1, 'E':4, 'W':3},
        6:{'N':5, 'S':2, 'E':4, 'W':3},
        }
    def __init__(self, num):
        for i, v in enumerate(num):
             self.num[i+1] = v
    def move(self, direct):
        self.current = self.map[self.current][direct]
        return self.map[self.current][direct]
    def getNum(self):
        return self.num[self.current]

num = map(int, raw_input().split())
direction = raw_input()
a = Dice(num)
for d in list(direction):
    a.move(d)
print a.getNum()

Submission status: Wrong Answer

Solution code:
def North(dice):
    w = dice[0]
    dice[0] = dice[4]
    dice[4] = dice[5]
    dice[5] = dice[1]
    dice[1] = w
    return dice
def East(dice):
    w = Dice[0]
    dice[0] = dice[3]
    dice[3] = dice[5]
    dice[5] = dice[2]
    dice[2] = w
    return dice
def South(dice):
    w = dice[0]
    dice[0] = dice[1]
    dice[1] = dice[5]
    dice[5] = dice[4]
    dice[4] = w
    return dice
def West(dice):
    w = dice[0]
    dice[0] = dice[2]
    dice[2] = dice[5]
    dice[5] = dice[3]
    dice[3] = w
    return dice

Dice = input().split()
Roll = list(input())

for roll in Roll:
    if roll == 'N':
        Dice = North(Dice)
        continue
    if roll == 'E':
        Dice = East(Dice)
        continue
    if roll == 'S':
        Dice = South(Dice)
        continue
    if roll == 'W':
        Dice = West(Dice)
        continue

print(Dice[0])

Submission status: Wrong Answer

Solution code:
class Dice:

    __dSNWE ={'S': (4, 0, 2, 3, 4, 4) , 'N': (1, 5, 2, 3, 0, 4),
             'W': (2, 1, 5, 0, 4, 3), 'E': (3, 1, 0, 5, 4, 2)}

    def __init__(self, v): # v [Top, Front, Right, Left, Back, Bottom ]
        self.view = v


    def rotateDice(self, direction):
        self.view = [self.view[i] for i in Dice.__dSNWE[direction]]

d1 = Dice(list(map(int, input().split())))
for d in input():
    d1.rotateDice(d)
print(d1.view[0])

Submission status: Wrong Answer

Solution code:
#----------------- Dice 1 ---------------------------
class Dice:

    __dSNWE ={'S': (4, 0, 2, 3, 5, 4) , 'N': (1, 5, 2, 3, 0, 4),
             'W': (2, 1, 5, 0, 4, 3), 'E': (3, 1, 0, 5, 4, 2)}

    def __init__(self, v): # v [Top, Front, Right, Left, Back, Bottom ]
        self.view = v


    def rotateDice(self, direction):
        self.view = [self.view[i] for i in Dice.__dSNWE[direction]]

d1 = Dice(list(map(int, input().split())))
for d in input():
    d1.rotateDice(d)
print(d1.view[0])

Submission status: Wrong Answer

Solution code:
#N E S W
def move_func(dice_list, dir):
	new_dice = []
	if dir=="N":
		new_dice.append(dice_list[1])
		new_dice.append(dice_list[5])
		new_dice.append(dice_list[2])
		new_dice.append(dice_list[3])
		new_dice.append(dice_list[0])
		new_dice.append(dice_list[4])
	elif dir=="E":
		new_dice.append(dice_list[3])
		new_dice.append(dice_list[1])
		new_dice.append(dice_list[0])
		new_dice.append(dice_list[5])
		new_dice.append(dice_list[4])
		new_dice.append(dice_list[2])
	elif dir=="S":
		new_dice.append(dice_list[4])
		new_dice.append(dice_list[0])
		new_dice.append(dice_list[2])
		new_dice.append(dice_list[3])
		new_dice.append(dice_list[5])
		new_dice.append(dice_list[1])
	elif dir=="W":
		new_dice.append(dice_list[2])
		new_dice.append(dice_list[1])
		new_dice.append(dice_list[5])
		new_dice.append(dice_list[3])
		new_dice.append(dice_list[4])
		new_dice.append(dice_list[0])
	return new_dice

try:
	while True:
		dice_list = input().split(" ")
		move_cmd = input()
		for cmd in  move_cmd:
			dice_list = move_func(dice_list, cmd)
			
		print(dice_list[0])
except EOFError:
	pass

Submission status: Wrong Answer

Solution code:
class dice:
    directions = ['S', 'E', 'N', 'W']
    def __init__(self, strlabels):
        label = strlabels.split()
        self.up = label[0]
        self.side = label[1:5]
        self.side[2], self.side[3] = self.side[3], self.side[2]
        self.down = label[5]

    def roll(self, direction):
        tmp = self.down
        self.down = self.side[self.directions.index(direction)]
        self.side[self.directions.index(direction)] = tmp
        tmp = self.up
        self.up = self.side[(self.directions.index(direction)+2)%4]
        self.side[(self.directions.index(direction)+2)%4] = tmp

    def pFace(self, initial):
        if initial == 'u':
            print(self.up)
        elif initial == 'd':
            print(self.down)
        else:
            print(self.side[directions.index(direction)])

dice1 = dice(input())
for direction in input():
    dice1.roll(direction)

dice1.pFace('u')

Submission status: Wrong Answer

Solution code:
class dice:
    directions = ['S', 'E', 'N', 'W']
    def __init__(self, strlabels):
        label = strlabels.split()
        self.top = label[0]
        self.side = label[1:5]
        self.side[2], self.side[3] = self.side[3], self.side[2]
        self.down = label[5]
        print(self.top, self.side, self.down)

    def roll(self, direction):
        tmp = self.top
        self.top = self.side[self.directions.index(direction)]
        self.side[self.directions.index(direction)] = tmp
        tmp = self.down
        self.down = self.side[(self.directions.index(direction)+2)%4]
        self.side[(self.directions.index(direction)+2)%4] = tmp
        print(self.top, self.side, self.down)

    def pFace(self, initial):
        if initial == 'u':
            print(self.top)
        elif initial == 'd':
            print(self.down)
        else:
            print(self.side[directions.index(direction)])

dice1 = dice(input())
for direction in input():
    dice1.roll(direction)

dice1.pFace('u')

Submission status: Wrong Answer

Solution code:
class dice:
    directions = ['S', 'E', 'N', 'W']
    def __init__(self, strlabels):
        label = strlabels.split()
        self.top = label[0]
        self.side = label[1:5]
        self.side[2], self.side[3] = self.side[3], self.side[2]
        self.down = label[5]
        #print(self.top, self.side, self.down)

    def roll(self, direction):
        tmp = self.top
        self.top = self.side[self.directions.index(direction)]
        self.side[self.directions.index(direction)] = tmp
        tmp = self.down
        self.down = self.side[(self.directions.index(direction)+2)%4]
        self.side[(self.directions.index(direction)+2)%4] = tmp
        #print(self.top, self.side, self.down)

    def pFace(self, initial):
        if initial == 'u':
            print(self.top)
        elif initial == 'd':
            print(self.down)
        else:
            print(self.side[directions.index(direction)])

dice1 = dice(input())
for direction in input():
    dice1.roll(direction)

dice1.pFace('u')

Submission status: Wrong Answer

Solution code:
class dice:
    directions = ['S', 'E', 'N', 'W']
    def __init__(self, strlabels):
        label = strlabels.split()
        self.top = label[0]
        self.side = label[1:5]
        self.side[2], self.side[3] = self.side[3], self.side[2]
        self.down = label[5]
        print(self.top, self.side, self.down)

    def roll(self, direction):
        tmp = self.top
        self.top = self.side[(self.directions.index(direction)+2)%4]
        self.side[(self.directions.index(direction)+2)%4] = self.down
        self.down = self.side[self.directions.index(direction)]
        self.side[self.directions.index(direction)] = tmp
        print(self.top, self.side, self.down)

    def pFace(self, initial):
        if initial == 'u':
            print(self.top)
        elif initial == 'd':
            print(self.down)
        else:
            print(self.side[directions.index(direction)])

dice1 = dice(input())
for direction in input():
    dice1.roll(direction)

dice1.pFace('u')

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self,l):
        self.l = l
    
    def N(self):
        self.l[0], self.l[1], self.l[5], self.l[4] = self.l[4], self.l[0], self.l[1], self.l[5]
        
    def S(self):
        self.l[0], self.l[4], self.l[5], self.l[1] = self.l[1], self.l[0], self.l[4], self.l[5]
    
    def W(self):
        self.l[0], self.l[3], self.l[5], self.l[2] = self.l[2], self.l[0], self.l[3], self.l[5]
        
    def E(self):
        self.l[0], self.l[2], self.l[5], self.l[3] = self.l[3], self.l[0], self.l[2], self.l[5]
    
    def number(self, i):
        return self.l[i - 1]
    
        
dice = Dice(list(map(int, input().split())))
s = list(input())

for i in s:
    if i == "N":
        dice.N()
    elif i == "S":
        dice.S()
    elif i == "W":
        dice.W()
    elif i == "E":
        dice.E()
print(dice.number(1))