modify input.java

Type-safe enumeration pattern, avoid IllegalArgumentException.