public class Solution { public static void main(String[] args) throws IOException { HashMap<String, Integer> month = new HashMap<>(); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); month.put("January", 1); month.put("February", 2); month.put("March", 3); month.put("April", 4); month.put("May", 5); month.put("June", 6); month.put("July", 7); month.put("August", 8); month.put("September", 9); month.put("October", 10); month.put("November", 11); month.put("December", 12); String sresult = reader.readLine().toUpperCase(); Iterator<Map.Entry<String, Integer>> iterator = month.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, Integer> s = iterator.next(); if (s.getKey().toUpperCase().equals(sresult)) { System.out.println("\" " + s.getKey() + " is the " + s.getValue() + " month\"."); } } } }