from math import sqrt
S = input()
direction = {"UD":0,"LR":0}
for s in S:
    if s in ("N","S"):
        walk = 1 if s == "N" else -1
        dire = "UD"
    else:
        walk = 1 if s == "E" else -1
        dire = "LR"
    direction[dire]+=walk
ud = abs(direction["UD"])
lr = abs(direction["LR"])
move = sqrt(ud ** 2 + lr ** 2)
print(move)