import java.awt.Point; class C{ public static void main(String[]$){ Point p=new Point(0,0); for(char c:new java.util.Scanner(System.in).next().toCharArray()) { if(c=='N')++p.y; if(c=='E')++p.x; if(c=='W')--p.x; if(c=='S')--p.y; } System.out.println(p.distance(0,0)); } }