import java.util.*; public class RedRoverValidator { public static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); String path = scan.next(); if (scan.hasNext()) { throw new Exception("Too many strings!"); } if (path.length() > 100) { throw new Exception("Path is too long at length " + path.length()); } for (int i = 0; i < path.length(); i++) { char c = path.charAt(i); if (c != 'N' && c != 'E' && c != 'W' && c != 'S') { throw new Exception("Invalid character: " + c); } } System.exit(42); } }