public String optimize(String inst) {
		char[] charArray = inst.toCharArray();
		for (int i = 0; i < charArray.length; i++) {
			char c = charArray[i];
			for (int j = 0; j < charArray.length; j++) {
				if (charArray[i] == 'N' && charArray[j] == 'S'
						|| charArray[i] == 'W' && charArray[j] == 'E') {
					charArray[i] = charArray[j] = 0;
				}
			}
		}
		Arrays.sort(charArray);
		String string = "";
		for (char c : charArray) {
			if (c != 0) {
				string += c;
			}
		}
		return string;
	}