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