#coding:utf-8 from math import sqrt S=raw_input() x=0 y=0 for i in S: if i=='N': y+=1 elif i=='S': y-=1 elif i=='E': x+=1 else: x-=1 ans=sqrt(pow(x,2)+pow(y,2)) print ans