public class Solution {
public static void main(String[] args) throws IOException {
HashMap<String, Integer> map = new HashMap<>();
map.put("January", 0);
map.put("February", 1);
map.put("March", 2);
map.put("April", 3);
map.put("May", 4);
map.put("June", 5);
map.put("July", 6);
map.put("August", 7);
map.put("September", 8);
map.put("October", 9);
map.put("November", 10);
map.put("December", 11);
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String mouth = reader.readLine();
for (HashMap.Entry<String, Integer> v : map.entrySet()) {
String k = v.getKey();
if (mouth.equals(k)) {
System.out.println(v.getKey() + " is " + map.get(k) + " month");
}
}
}
}package com.javarush.task.task08.task0828;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
/*
Номер месяца
*/
public class Solution {
public static void main(String[] args) throws IOException {
HashMap<String, Integer> map = new HashMap<>();
map.put("January", 0);
map.put("February", 1);
map.put("March", 2);
map.put("April", 3);
map.put("May", 4);
map.put("June", 5);
map.put("July", 6);
map.put("August", 7);
map.put("September", 8);
map.put("October", 9);
map.put("November", 10);
map.put("December", 11);
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String mouth = reader.readLine();
for (HashMap.Entry<String, Integer> v : map.entrySet()) {
String k = v.getKey();
if (mouth.equals(k)) {
System.out.println(v.getValue());
}
}
}
}