import math a=input() e=a.count("E") n=a.count("N") w=a.count("W") s=a.count("S") if e>w: b=e-w else: b=w-e if n>s: c=n-s else: c=s-n print(math.sqrt(b+c))