#!/usr/bin/python from collections import Counter dic = { 'N': (0, 1), 'E': (1, 0), 'W': (-1, 0), 'S': (0, -1), } calc_distance = lambda k: map(lambda v: v*counter[k], dic[k]) S = raw_input() counter = Counter(S) arr = map(calc_distance, counter.keys()) x, y = map(sum, zip(*arr)) print (x*x + y*y) ** .5