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 d=b*b+c*c print(math.sqrt(b*b+c*c))