/* * 17:49 solved */ package diegame; import java.io.File; import java.util.Scanner; public class Main { /** * @param args */ public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); try { sc = new Scanner(new File("die.txt")); } catch(Exception e) { e.printStackTrace(); } while(sc.hasNext()) { int n = sc.nextInt(); if(n == 0) { break; } Die die = new Die(); for(int i = 0; i < n; i++) { String str = sc.next(); if(str.equals("north")) { die.moveN(); } else if(str.equals("west")) { die.moveW(); } else if(str.equals("south")) { die.moveS(); } else if(str.equals("east")) { die.moveE(); } } System.out.println(die.getTop()); } } } class Die { private int top, north, west; public int getTop() { return this.top; } public Die(){ top = 1; north = 2; west = 3; } public void moveN() { int t, n, w; t = 7-north; n = top; w = west; top = t; north = n; west = w; } public void moveS() { int t, n, w; t = north; n = 7-top; w = west; top = t; north = n; west = w; } public void moveE() { int t, n, w; t = west; n = north; w = 7-top; top = t; north = n; west = w; } public void moveW() { int t, n, w; t = 7-west; n = north; w = top; top = t; north = n; west = w; } }