Physical Education Is a Coding Subject
Time limit2sMemory limit1024 MB
Given ten turn instructions (right, about, left) starting from north, print the final facing direction as N, E, S, or W.
- Level
Easy1 of 10
- Topics
- Implementation, Simulation
- Solved
- No attempts yet
Problem
The UCPC Elementary School sports day is coming up. The students of Class 1, Grade 1 at UCPC Elementary School are practicing facing a specific direction as their homeroom teacher Jongseo instructs.
The students start out facing north. Jongseo gives a total of ten instructions of the following three types:
- Right turn: each student turns 90 degrees to the right from the current direction.
- About turn: each student turns 180 degrees to the right from the current direction.
- Left turn: each student turns 90 degrees to the left from the current direction.
Jongseo knows that elementary students find it hard to follow instructions exactly, so he decided to give candy to students who follow his instructions successfully. Help the students change their facing direction according to Jongseo's instructions and find the direction they face at the end.
Input
Ten lines follow, each containing one integer () that describes the -th instruction from Jongseo, one per line. Each is 1, 2, or 3.
- If , the -th instruction is a right turn,
- If , the -th instruction is an about turn,
- If , the -th instruction is a left turn.
Output
Print the character for the direction the students face after carrying out all ten instructions. If they face north, print N. If they face east, print E. If they face west, print W. If they face south, print S.