a = gets.chomp.to_sym b = gets.chomp.to_sym directions = { E: 1, S: 2, W: 3, N: 4 } if directions[a] <= directions[b] puts (directions[b] - directions[a]) else puts 4 - directions[a] + directions[b] end