from math import sqrt a = input() n = a.count("N") e = a.count("E") w = a.count("W") s = a.count("S") print(sqrt((n - s)**2 + (w - e)**2))