-Code
input()
n_s, w_e = 0, 0
for el in input():
if el == "N":
n_s += 1
elif el == "S":
n_s -= 1
elif el == "W":
w_e += 1
else:
w_e -= 1
print(abs(n_s) + abs(w_e))
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 21143번 Magic Trick (0) | 2024.01.20 |
---|---|
[백준/파이썬] 15035번 I Work All Day (0) | 2024.01.19 |
[백준/파이썬] 31261번 I MADE UP A NUMBER (0) | 2024.01.17 |
[백준/파이썬] 24088번 運動会 (Sports Day) (0) | 2024.01.16 |
[백준/파이썬] 4841번 Look and Say (0) | 2024.01.15 |