# coding: utf-8 from collections import Counter import math s = Counter(input()) x = s['E'] - s['W'] y = s['N'] - s['S'] print(math.sqrt(x*x + y*y))