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:
class Daise:
    def __init__(self, info_list):
        self.T = info_list[0]
        self.S = info_list[1]
        self.N = info_list[2]
        self.W = info_list[3]
        self.E = info_list[4]
        self.B = info_list[5]
    
    def change(self, axis):
        if axis == 'S':
            self.T, self.B, self.S, self.N = self.N, self.S, self.T, self.B
        
        elif axis == 'E':
            self.T, self.B, self.E, self.W = self.W, self.E, self.T, self.B
        
        elif axis == 'W':
            self.T, self.B, self.W, self.E = self.E, self.W, self.T, self.B
        
        elif axis == 'N':
            self.T, self.B, self.N, self.S = self.S, self.N, self.T, self.B


if __name__ == '__main__':
    info = list(map(str, input().split()))
    axis = str(input())
    obj = Daise(info)

    for i in axis:
        obj.change(i)
    print(obj.T)

Submission status: Wrong Answer

Solution code:
class Dice():
    def __init__(self,num):
        self.num = num

    def east(self):
        temp = num
        num[1-1] = temp[4-1]
        num[4-1] = temp[6-1]
        num[6-1] = temp[3-1]
        num[3-1] = temp[1-1]

    def north(self):
        temp = num
        num[1-1] = temp[2-1]
        num[2-1] = temp[6-1]
        num[6-1] = temp[5-1]
        num[5-1] = temp[1-1]

    def south(self):
        temp = num
        num[1-1] = temp[5-1]
        num[5-1] = temp[6-1]
        num[6-1] = temp[2-1]
        num[2-1] = temp[1-1]

    def west(self):
        temp = num
        num[1-1] = temp[3-1]
        num[3-1] = temp[6-1]
        num[6-1] = temp[4-1]
        num[4-1] = temp[1-1]

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

Submission status: Wrong Answer

Solution code:
labels = input().split()
indexs = [0, 1, 2, 3, 4, 5]
copy = [0, 0, 0, 0, 0, 0]
order = input()
rolls = {'N':[2, 1, 5, 0, 4, 3], 
         'E':[1, 5, 2, 3, 0, 4], 
         'S':[3, 1, 0, 5, 4, 2], 
         'W':[4, 0, 2, 3, 5, 1]
        }
for d in order:
    for i in range(6):
        copy[i] = rolls[d][indexs[i]]
    indexs = copy
    #print(indexs)
print(labels[indexs[0]])

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

faces = list(map(int, input().split()))
print(faces)
command = list(input())
print(command)


def dice(face, command):
    face_1 = {"E": 4, "W": 3, "S": 5, "N": 2}
    face_2 = {"E": 4, "W": 3, "S": 1, "N": 6}
    face_3 = {"E": 2, "W": 5, "S": 1, "N": 6}
    face_4 = {"E": 5, "W": 2, "S": 1, "N": 6}
    face_5 = {"E": 4, "W": 3, "S": 6, "N": 1}
    face_6 = {"E": 4, "W": 3, "S": 2, "N": 1}

    rulebase = [face_1, face_2, face_3, face_4, face_5, face_6]

    return rulebase[face - 1][command]


top = 1

for c in command:
    top = dice(top, c)
    print(top)

print(faces[top - 1])

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

faces = list(map(int, input().split()))
command = list(input())


def dice(face, command):
    face_1 = {"E": 4, "W": 3, "S": 5, "N": 2}
    face_2 = {"E": 4, "W": 3, "S": 1, "N": 6}
    face_3 = {"E": 2, "W": 5, "S": 1, "N": 6}
    face_4 = {"E": 5, "W": 2, "S": 1, "N": 6}
    face_5 = {"E": 4, "W": 3, "S": 6, "N": 1}
    face_6 = {"E": 4, "W": 3, "S": 2, "N": 1}

    rulebase = [face_1, face_2, face_3, face_4, face_5, face_6]

    return rulebase[face - 1][command]


top = 1

for c in command:
    top = dice(top, c)

print(faces[top - 1])

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

faces = list(map(int, input().split()))
command = list(input())


def dice(face, command):
    face_1 = {"E": 4, "W": 3, "S": 5, "N": 2}
    face_2 = {"E": 4, "W": 3, "S": 1, "N": 6}
    face_3 = {"E": 1, "W": 6, "S": 5, "N": 2}
    face_4 = {"E": 6, "W": 1, "S": 5, "N": 2}
    face_5 = {"E": 4, "W": 3, "S": 6, "N": 1}
    face_6 = {"E": 4, "W": 3, "S": 2, "N": 1}

    rulebase = [face_1, face_2, face_3, face_4, face_5, face_6]

    return rulebase[face - 1][command]


top = 1

for c in command:
    top = dice(top, c)

print(faces[top - 1])

Submission status: Wrong Answer

Solution code:
import copy


class Dice:
    def __init__(self, eyes):
        self._top = eyes[0]
        self._front = eyes[1]
        self._right = eyes[2]
        self._left = eyes[3]
        self._back = eyes[4]
        self._bottom = eyes[5]

    @property
    def eye(self):
        return self._top

    def roll(self, direction):
        old = copy.copy(self)
        if direction == 'N':
            self._top = old._front
            self._front = old._bottom
            self._back = old._top
            self._bottom = old._back
        elif direction == 'S':
            self._top = old._back
            self._front = old._top
            self._back = old._bottom
            self._bottom = old._front
        elif direction == 'W':
            self._top = old._right
            self._right = old._back
            self._left = old._top
            self._back = old._left
        elif direction == 'E':
            self._top = old._left
            self._right = old._top
            self._left = old._back
            self._back = old._right
        else:
            raise ValueError('NEWS箱推し')


eyes = input().split()
dice = Dice(eyes)

direction_text = input()
for d in direction_text:
    dice.roll(d)

print(dice.eye)

Submission status: Wrong Answer

Solution code:
## サイコロ

d1, d2, d3, d4, d5, d6 = input().split()

dice = {
    '1': d1,
    '2': d2,
    '3': d3,
    '4': d4,
    '5': d5,
    '6': d6
}

spin_dict = {
    '1' : {
        'S' : '6', #上
        'N' : '2', #下
        'E' : '4', #左
        'W' : '3', #右
    },
    '2' : {
        'S' : '1', #上
        'N' : '6', #下
        'E' : '4', #左
        'W' : '3', #右
    },
    '3' : {
        'S' : '1', #上
        'N' : '6', #下
        'E' : '2', #左
        'W' : '5', #右
    },
    '4' : {
        'S' : '1', #上
        'N' : '6', #下
        'E' : '5', #左
        'W' : '2', #右
    },
    '5' : {
        'S' : '1', #上
        'N' : '6', #下
        'E' : '3', #左
        'W' : '4', #右
    },
    '6' : {
        'S' : '2', #上
        'N' : '1', #下
        'E' : '4', #左
        'W' : '3', #右
    },
}

spins = input()

num = '1'
for direction in spins:
    num = spin_dict[num][direction]

print(dice[num])

Submission status: Wrong Answer

Solution code:
class Dice():
        def __init__(self,data):
                self.number = data

                self.rots = [5,1,3,4,6,2]
                self.rote = [4,2,1,6,5,3]
                self.rotw = [3,2,6,1,5,4]
                self.rotn = [2,6,3,4,1,5]
                self.tmp = self.number
        def _rot(self,rott):
                for _ in range(6):
                        self.number[_] = self.tmp[rott[_]-1]
                self.tmp = self.number

        def rota_S(self):
                self._rot(self.rots)
        def rota_E(self):
                self._rot(self.rote)
        def rota_W(self):
                self._rot(self.rotw)
        def rota_N(self):
                self._rot(self.rotn)
        def get_top(self):
                return(self.number[0])
data = list(map(int,input().split()))
opt = input()

mydice = Dice(data)

for c in range(len(opt)):

        if(opt[c] == "S"):      mydice.rota_S()
        elif(opt[c] == "E"):    mydice.rota_E()
        elif(opt[c] == "W"):     mydice.rota_W()
        elif(opt[c] == "N"):     mydice.rota_N()
print(mydice.get_top())

Submission status: Wrong Answer

Solution code:

class Dice():
        def __init__(self,data):
                self.number = data

        def rota_S(self):
                self.number[0],self.number[1],self.number[5],self.number[4] = self.number[1],self.number[5],self.number[4],self.number[0]
        def rota_E(self):
                self.number[0],self.number[2],self.number[5],self.number[3] = self.number[2],self.number[5],self.number[3],self.number[0]
        def rota_W(self):
                self.number[0],self.number[3],self.number[5],self.number[2] = self.number[3],self.number[5],self.number[2],self.number[0]
        def rota_N(self):
                self.number[0],self.number[4],self.number[5],self.number[1] = self.number[4],self.number[5],self.number[1],self.number[0]

        def get_top(self):
                return self.number[0]
data = list(map(int,input().split()))
opt = input()

mydice = Dice(data)
print(mydice.number)
for c in range(len(opt)):
        print(opt[c])
        if(opt[c] == "S"):      mydice.rota_S()
        elif(opt[c] == "E"):    mydice.rota_E()
        elif(opt[c] == "W"):     mydice.rota_W()
        elif(opt[c] == "N"):     mydice.rota_N()
        else: print("something error")
print(mydice.get_top())

Submission status: Wrong Answer

Solution code:

class Dice():
        def __init__(self,data):
                self.number = data

        def rota_S(self):
                self.number[0],self.number[1],self.number[5],self.number[4] = self.number[1],self.number[5],self.number[4],self.number[0]
        def rota_E(self):
                self.number[0],self.number[2],self.number[5],self.number[3] = self.number[2],self.number[5],self.number[3],self.number[0]
        def rota_W(self):
                self.number[0],self.number[3],self.number[5],self.number[2] = self.number[3],self.number[5],self.number[2],self.number[0]
        def rota_N(self):
                self.number[0],self.number[4],self.number[5],self.number[1] = self.number[4],self.number[5],self.number[1],self.number[0]

        def get_top(self):
                return self.number[0]
data = list(map(int,input().split()))
opt = input()

mydice = Dice(data)

for c in range(len(opt)):
        print(opt[c])
        if(opt[c] == "S"):      mydice.rota_S()
        elif(opt[c] == "E"):    mydice.rota_E()
        elif(opt[c] == "W"):     mydice.rota_W()
        elif(opt[c] == "N"):     mydice.rota_N()
        else: print("something error")
print(mydice.get_top())

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, data):
        self.data = data

    def move(self, direction):
        if direction == 'E':
            self.data[0],self.data[3],self.data[5],self.data[2] = \
                    self.data[3],self.data[5],self.data[2],self.data[0]
        elif direction == 'N':
            self.data[0],self.data[4],self.data[5],self.data[1] = \
                    self.data[1],self.data[0],self.data[4],self.data[5]
        elif direction == 'S':
            self.data[0],self.data[1],self.data[5],self.data[4] = \
                    self.data[4],self.data[0],self.data[1],self.data[5]
        elif direction == 'W':
             self.data[0],self.data[1],self.data[5],self.data[4] = \
                    self.data[2],self.data[5],self.data[3],self.data[0]


    def getTop(self):
        return self.data[0]

dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
    dice.move(cmd[i])

print(dice.getTop())

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, data):
        self.data = data

    def move(self, direction):
        if direction == 'E':
            self.data[0],self.data[3],self.data[5],self.data[2] = \
                    self.data[3],self.data[5],self.data[2],self.data[0]
        elif direction == 'N':
            self.data[0],self.data[4],self.data[5],self.data[1] = \
                    self.data[1],self.data[0],self.data[4],self.data[5]
        elif direction == 'S':
            self.data[0],self.data[1],self.data[5],self.data[4] = \
                    self.data[4],self.data[0],self.data[1],self.data[5]
        elif direction == 'W':
             self.data[0],self.data[2],self.data[5],self.data[4] = \
                    self.data[4],self.data[0],self.data[2],self.data[5]


    def getTop(self):
        return self.data[0]

dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
    dice.move(cmd[i])

print(dice.getTop())

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__ (self,data):
        self.data = data

    def move(self,direction):
        if direction == 'E':
            self.data[0],self.data[3],self.data[5],self.data[2] = \
                    self.data[3],self.data[5],self.data[2],self.data[0]
        elif direction == 'N':
            self.data[0],self.data[4],self.data[5],self.data[1] = \
                    self.data[4],elf.data[5],self.data[1],self.data[0]
        elif direction == 'S':
            self.data[0],self.data[1],self.data[5],self.data[4] = \
                    self.data[4],self.data[0],self.data[1],self.data[5]
        elif direction == 'W':
            self.data[0],self.data[2],self.data[5],self.data[3] = \
                    self.data[2],self.data[5],self.data[3],self.data[0]

    def getTop(self):
        return self.data[0]

dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
    dice.move(cmd[i])
    print(dice.getTop())

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__ (self,data):
        self.data = data

    def move(self,direction):
        if direction == 'E':
            self.data[0],self.data[3],self.data[5],self.data[2] = \
                    self.data[3],self.data[5],self.data[2],self.data[0]
        elif direction == 'N':
            self.data[0],self.data[4],self.data[5],self.data[1] = \
                    self.data[1],elf.data[0],self.data[4],self.data[5]
        elif direction == 'S':
            self.data[0],self.data[1],self.data[5],self.data[4] = \
                    self.data[4],self.data[0],self.data[1],self.data[5]
        elif direction == 'W':
            self.data[0],self.data[2],self.data[5],self.data[3] = \
                    self.data[2],self.data[5],self.data[3],self.data[0]

    def getTop(self):
        return self.data[0]

dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
    dice.move(cmd[i])
    print(dice.getTop())

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__ (self,data):
        self.data = data

    def move(self,direction):
        if direction == 'E':
            self.data[0],self.data[3],self.data[5],self.data[2] = \
                    self.data[3],self.data[5],self.data[2],self.data[0]
        elif direction == 'N':
            self.data[0],self.data[4],self.data[5],self.data[1] = \
                    self.data[1],self.data[0],self.data[4],self.data[5]
        elif direction == 'S':
            self.data[0],self.data[1],self.data[5],self.data[4] = \
                    self.data[4],self.data[0],self.data[1],self.data[5]
        elif direction == 'W':
            self.data[0],self.data[2],self.data[5],self.data[3] = \
                    self.data[2],self.data[5],self.data[3],self.data[0]

    def getTop(self):
        return self.data[0]

dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
    dice.move(cmd[i])
    print(dice.getTop())

Submission status: Wrong Answer

Solution code:
import sys

dice = [int(i) for i in sys.stdin.readline().split()]
command = sys.stdin.readline().strip()
for c in command:
    if c == "N":
        dice = (dice[1], dice[5], dice[2], dice[3], dice[0], dice[4])
    elif c == "S":
        dice = (dice[4], dice[0], dice[2], dice[3], dice[5], dice[2])
    elif c == "W":
        dice = (dice[2], dice[1], dice[5], dice[0], dice[4], dice[3])
    elif c == "E":
        dice = (dice[3], dice[1], dice[0], dice[5], dice[4], dice[2])
print(dice[0])

Submission status: Wrong Answer

Solution code:
import sys
data=list(map(int,input().split()))
order=sys.stdin.readline()
char_list=list(order)
for i in char_list:
	
	if i=='N':
		print(i)
		k=data[1]
		m=data[5]
		data[0]=data[1]
		data[1]=data[5]
		data[4]=k
		data[5]=m
	elif i=='E':
		k=data[0]
		m=data[2]
		data[0]=data[3]
		data[2]=k
		data[3]=data[5]	
		data[5]=m
	elif i=='S':
		k=data[0]
		m=data[1]
		data[0]=data[4]
		data[1]=k
		data[4]=data[5]
		data[5]=m
	elif i=='W':
		k=data[0]
		m=data[3]
		data[0]=data[2]
		data[3]=data[5]
		data[4]=k
		data[5]=m	

print(data[0])

Submission status: Wrong Answer

Solution code:
import sys
data=list(map(int,input().split()))
order=sys.stdin.readline()
char_list=list(order)
for i in char_list:
	
	if i=='N':
		print(i)
		k=data[1]
		m=data[5]
		data[0]=data[1]
		data[1]=data[5]
		data[4]=k
		data[5]=m
	elif i=='E':
		k=data[0]
		m=data[2]
		data[0]=data[3]
		data[2]=k
		data[3]=data[5]	
		data[5]=m
	elif i=='S':
		k=data[0]
		m=data[1]
		data[0]=data[4]
		data[1]=k
		data[4]=data[5]
		data[5]=m
	elif i=='W':
		k=data[0]
		m=data[3]
		data[0]=data[2]
		data[2]=data[5]
		data[3]=k
		data[5]=m	
		print(data)
print(data[0])

Submission status: Wrong Answer

Solution code:
import sys
data=list(map(int,input().split()))
order=sys.stdin.readline()
char_list=list(order)
for i in char_list:
	
	if i=='N':
		print(i)
		k=data[1]
		m=data[5]
		data[0]=data[1]
		data[1]=data[5]
		data[4]=k
		data[5]=m
	elif i=='E':
		k=data[0]
		m=data[2]
		data[0]=data[3]
		data[2]=k
		data[3]=data[5]	
		data[5]=m
	elif i=='S':
		k=data[0]
		m=data[1]
		data[0]=data[4]
		data[1]=k
		data[4]=data[5]
		data[5]=m
	elif i=='W':
		k=data[0]
		m=data[3]
		data[0]=data[2]
		data[2]=data[5]
		data[3]=k
		data[5]=m	
		
print(data[0])

Submission status: Wrong Answer

Solution code:
import sys
data=list(map(int,input().split()))
order=sys.stdin.readline()
char_list=list(order)
for i in char_list:
	
	if i=='N':
		k=data[1]
		m=data[5]
		data[0]=data[1]
		data[1]=data[5]
		data[4]=k
		data[5]=m
	elif i=='E':
		k=data[0]
		m=data[2]
		data[0]=data[3]
		data[2]=k
		data[3]=data[5]	
		data[5]=m
	elif i=='S':
		k=data[0]
		m=data[1]
		data[0]=data[4]
		data[1]=k
		data[4]=data[5]
		data[5]=m
	elif i=='W':
		k=data[0]
		m=data[3]
		data[0]=data[2]
		data[2]=data[5]
		data[3]=k
		data[5]=m	
		print(data)
print(data[0])

Submission status: Wrong Answer

Solution code:
import sys
data=list(map(int,input().split()))
order=sys.stdin.readline()
char_list=list(order)
for i in char_list:
	
	if i=='N':
		k=data[1]
		m=data[5]
		data[0]=data[1]
		data[1]=data[5]
		data[4]=k
		data[5]=m
	elif i=='E':
		k=data[0]
		m=data[2]
		data[0]=data[3]
		data[2]=k
		data[3]=data[5]	
		data[5]=m
	elif i=='S':
		k=data[0]
		m=data[1]
		data[0]=data[4]
		data[1]=k
		data[4]=data[5]
		data[5]=m
	elif i=='W':
		k=data[0]
		m=data[3]
		data[0]=data[2]
		data[2]=data[5]
		data[3]=k
		data[5]=m	
print(data[0])

Submission status: Wrong Answer

Solution code:
import sys
data=list(map(int,input().split()))
order=sys.stdin.readline()
char_list=list(order)
for i in char_list:
	print(i)
	if i=='N':
		k=data[0]
		m=data[4]
		data[0]=data[1]
		data[1]=data[5]
		data[4]=k
		data[5]=m
	elif i=='E':
		k=data[0]
		m=data[2]
		data[0]=data[3]
		data[2]=k
		data[3]=data[5]	
		data[5]=m
	elif i=='S':
		k=data[0]
		m=data[1]
		data[0]=data[4]
		data[1]=k
		data[4]=data[5]
		data[5]=m
	elif i=='W':
		k=data[0]
		m=data[3]
		data[0]=data[2]
		data[2]=data[5]
		data[3]=k
		data[5]=m
print(data[0])

Submission status: Wrong Answer

Solution code:
l=map(int,raw_input().split())
n=raw_input()
ans=chk=0


def rolling(word,dice):
    if word=='S':
        dice[0],dice[1],dice[5],dice[4]=dice[4],dice[5],dice[1],dice[0]
    elif word=='N':
        dice[0],dice[1],dice[5],dice[4]=dice[1],dice[5],dice[4],dice[0]
    elif word=='W':
        dice[0],dice[2],dice[5],dice[3]=dice[2],dice[5],dice[3],dice[0]
    else:
        dice[0],dice[2],dice[5],dice[3]=dice[3],dice[5],dice[2],dice[0]
    return dice

for i in n:
    l=rolling(i,l)
print l[0]

Submission status: Wrong Answer

Solution code:
# coding=utf-8


class Dice(object):

    def __init__(self, label):
        self.label = label

    def rotateS(self):
        s1, s2, s3, s4, s5, s6 = self.label
        self.label = [s5, s1, s3, s4, s6, s2]

    def rotateN(self):
        s1, s2, s3, s4, s5, s6 = self.label
        self.label = [s2, s6, s3, s4, s1, s5]

    def rotateE(self):
        s1, s2, s3, s4, s5, s6 = self.label
        self.label = [s4, s2, s1, s6, s5, s3]

    def rotateW(self):
        s1, s2, s3, s4, s5, s6 = self.label
        self.label = [s5, s2, s6, s1, s5, s6]

    def rotate(self, r):
        if r == 'S':
            self.rotateS()
        elif r == 'N':
            self.rotateN()
        elif r == 'E':
            self.rotateE()
        elif r == 'W':
            self.rotateW()
        else:
            print 'Cannot rotate into ' + r + 'direction.'

    def getTopLabel(self):
        return self.label[0]


if __name__ == '__main__':
    d = Dice(map(int, raw_input().split()))
    rotations = raw_input()
    for r in rotations:
        d.rotate(r)
    print d.getTopLabel()

Submission status: Wrong Answer

Solution code:
# coding=utf-8


class Dice(object):

    def __init__(self, label):
        self.label = label

    def rotateS(self):
        s1, s2, s3, s4, s5, s6 = self.label
        self.label = [s5, s1, s3, s4, s6, s2]

    def rotateN(self):
        s1, s2, s3, s4, s5, s6 = self.label
        self.label = [s2, s6, s3, s4, s1, s5]

    def rotateE(self):
        s1, s2, s3, s4, s5, s6 = self.label
        self.label = [s4, s2, s1, s6, s5, s3]

    def rotateW(self):
        s1, s2, s3, s4, s5, s6 = self.label
        self.label = [s3, s2, s6, s1, s5, s6]

    def rotate(self, r):
        if r == 'S':
            self.rotateS()
        elif r == 'N':
            self.rotateN()
        elif r == 'E':
            self.rotateE()
        elif r == 'W':
            self.rotateW()
        else:
            print 'Cannot rotate into ' + r + 'direction.'

    def getTopLabel(self):
        return self.label[0]


if __name__ == '__main__':
    d = Dice(map(int, raw_input().split()))
    rotations = raw_input()
    for r in rotations:
        d.rotate(r)
    print d.getTopLabel()

Submission status: Wrong Answer

Solution code:
m={"E":[3,1,0,5,4,2], "N":[1,5,2,3,0,4], "W":[2,1,5,0,4,3], "S":[4,0,2,3,5,1]}
d=map(int, raw_input().split())
nd=[0]*6
dir=raw_input()
for i in range(len(dir)):
    x=dir[i]
    for j in range(6):
        nd[j]=d[m[x][j]]
    d=nd
print d[0]

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self, num_list):
        self.vertical_faces = [num_list[0], num_list[1], num_list[5], num_list[4]]
        self.horizonal_faces = [num_list[0], num_list[3], num_list[5], num_list[2]]

    def roll(self, direction):
        if direction == 'N':
            self.vertical_faces = self.vertical_faces[1:] + self.vertical_faces[:1]
            self.horizonal_faces[0] = self.vertical_faces[0]
        elif direction == 'S':
            self.vertical_faces = self.vertical_faces[3:] + self.vertical_faces[:3]
            self.horizonal_faces[0] = self.vertical_faces[0]
        elif direction == 'E':
            self.horizonal_faces = self.horizonal_faces[1:] + self.horizonal_faces[:1]
            self.vertical_faces[0] = self.horizonal_faces[0]
        else:
            self.horizonal_faces = self.horizonal_faces[3:] + self.horizonal_faces[:3]
            self.vertical_faces[0] = self.horizonal_faces[0]

num_list = list(map(int, input().split()))

dice = Dice(num_list)

directions = input()

for i in directions:
    dice.roll(i)

print(dice.vertical_faces[0])

Submission status: Wrong Answer

Solution code:
class Dice:
  def __init__(self):
    self.top = 1
    self.front = 2
    self.left = 3

  @property
  def bottom(self):
    return 7 - self.top

  @property
  def back(self):
    return 7 - self.front

  @property
  def right(self):
    return 7 - self.left

  def move(self, direction):
    if direction == 'N':
      bottom = self.bottom
      self.top = self.front
      self.front = bottom
    elif direction == 'W':
      right = self.right
      self.left = self.top
      self.top = right
    elif direction == 'E':
      bottom = self.bottom
      self.top = self.left
      self.left = bottom
    elif direction == 'S':
      back = self.back
      self.front = self.top
      self.top = back


dice = Dice()
numbers = input().split()
for cmd in input():
  dice.move(cmd)
print(numbers[dice.top - 1])

Submission status: Wrong Answer

Solution code:
class Dice:

    def __init__(self):
        d = map(int, raw_input().split(" "))
        self.c = raw_input()
        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]

    def __move_next(self, x, y):
        temp = y.pop(0)
        y.append(temp)
        x[0] = y[0]
        x[2] = y[2]

    def __move_prev(self, x, y):
        temp = y.pop(3)
        y.insert(0, temp)
        x[0] = y[0]
        x[2] = y[2]

    def execute(self):
        for i in self.c:
            self.__move(i, self.rows, self.cols)

    def __move(self, com, x, y):
        if com == "N":
            self.__move_prev(y, x)
            print self.rows[0]
        elif com == "S":
            self.__move_next(y, x)
            print self.rows[0]
        elif com == "E":
            self.__move_prev(x, y)
            print self.rows[0]
        elif com == "W":
            self.__move_next(x, y)
            print self.rows[0]

    def print_top(self):
        print self.rows[0]

dice = Dice()
dice.execute()
dice.print_top()

Submission status: Wrong Answer

Solution code:
class Dice:
    def __init__(self,n,e,s,w,u,d):
        self.n = n
        self.e = e
        self.s = s
        self.w = w
        self.u = u
        self.d = d
    def roll(self,dir):
        if (dir == "N"):
            tmp = self.n
            self.n = self.u
            self.u = self.s
            self.s = self.d
            self.d = tmp
        elif (dir == "E"):
            tmp = self.e
            self.e = self.u
            self.u = self.w
            self.w = self.d
            self.d = tmp
        elif (dir == "S"):
            tmp = self.s
            self.s = self.u
            self.u = self.n
            self.n = self.d
            self.d = tmp
        elif (dir == "W"):
            tmp = self.w
            self.w = self.u
            self.u = self.e
            self.e = self.d
            self.d = tmp

spots = raw_input().split()
operations = raw_input()

dice = Dice(*spots)
for i in operations:
    dice.roll(i)

print dice.u

Submission status: Wrong Answer

Solution code:
def move_dice(d, dir):
    if(dir == 'N'):
        d[0], d[1], d[4], d[5] = d[4], d[0], d[5], d[1]
    if(dir == 'S'):
        d[0], d[1], d[4], d[5] = d[1], d[5], d[0], d[4]
    if(dir == 'E'):
        d[0], d[2], d[3], d[5] = d[3], d[0], d[5], d[2]
    if(dir == 'W'):
        d[0], d[2], d[3], d[5] = d[2], d[5], d[0], d[3]


dice = list(map(int, input().split()))
command = input()
for c in command:
    move_dice(dice, c)
print(dice[0])

Submission status: Wrong Answer

Solution code:
# 23-Structure_and_Class-Dice_I.py

# ???????????? I
# ?¬?????±??????????????????????????????????????????¢??????????????\??¬????????§????????????????????°????????????????????????????????????

# ????????????????????¢??????????????¨????????? 1 ?????? 6 ????????????????????????????????????????????????
# ??\?????¨??????????????????????????¢?????????????????????????????°?????¨?????¢?????????????????????????????????????????§???
# ????????????????????¢?????°?????????????????????????????????
# ????????\??¬????????§??????????????¶?????????????????¨?????????????????????????????§?????????????????????????????????????????¨????????????

# Input
# ?????????????????¢?????°???????????????????????????????????????????????????????????§?????????????????????

# ???????????????????????¨????????????????????????????????????????????????????????????????????????????????????????????¨????????? E???N???S???W ????????????????????§??????

# Output
# ???????????????????????????????????????????????????????????¢?????°???????????????????????????????????????

# Constraints
# 0???0??? ??\?????????????????????????????¢?????°??? ???100???100
# 0???0??? ???????????¨????????????????????? ???100???100
# Note
# ?¶???????????????? Dice III, Dice IV ??§???????????°????????????????????±????????§???????????????????????????????§?????????§?????????????????????????????????

# Sample Input 1
# 1 2 4 8 16 32
# SE
# Sample Output 1
# 8
# ?????¢??? 1, 2, 4, 8, 16, 32 ??¨??????????????????????????? S ??????????????¢???????????????E ??????????????¢????????¨????????¢?????°?????? 8 ??????????????????



# Sample Input 2
# 1 2 4 8 16 32
# EESWN
# Sample Output 2
# 32

class Dice:
	def __init__(self, dice_num):
		self.side_top=1
		self.side_bot=6
		self.side_Nor=5
		self.side_Eas=3
		self.side_Sau=2
		self.side_Wes=4
		self.dice_num = dice_num

	def op_N(self):
		self.side_top, self.side_bot, self.side_Nor, self.side_Sau =\
		self.side_Sau, self.side_Nor, self.side_top, self.side_bot

	def op_E(self):
		self.side_top, self.side_bot, self.side_Eas, self.side_Wes =\
		self.side_Wes, self.side_Eas, self.side_top, self.side_bot

	def op_S(self):
		self.side_top, self.side_bot, self.side_Nor, self.side_Sau =\
		self.side_Nor, self.side_Sau, self.side_bot, self.side_top

	def op_W(self):
		self.side_top, self.side_bot, self.side_Eas, self.side_Wes =\
		self.side_Eas, self.side_Wes, self.side_bot, self.side_top

	def print_side_top(self):
		print( dice_num[self.side_top-1] )

	def print_side_all(self):
		print( "top:{}, bot:{}, Nor:{}, Eas{}, Sau:{}, Wes,{}.".format(self.side_top, self.side_bot, self.side_Nor, self.side_Eas, self.side_Sau, self.side_Wes ) )

dice_num = list( map(int, input().split()))
op = input()

dice_roll = Dice(dice_num) 
for i in op:
	if i == "N":
		dice_roll.op_N()
	elif i =="E":
		dice_roll.op_E()
	elif i =="S":
		dice_roll.op_S()
	elif i =="W":
		dice_roll.op_W()
	else:
		print("?????°??°")
	dice_roll.print_side_all()

dice_roll.print_side_top()