#python 3.5.2 # your code goes here import math S = input() y = S.count('N') - S.count('S') x = S.count('E') - S.count('W') print(math.sqrt(y**2 + x**2))