Знаю, что задачу можно решить распарсив дату, но решил сделать так и тут не понятная ситуция. Все работает кроме правильности вывода года. Подскажите почему вывод года некорректный? public class Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String parseDate = reader.readLine(); String[] dateLine = parseDate.split("-"); int year = Integer.parseInt(dateLine[0]); int month = Integer.parseInt(dateLine[1]); int day = Integer.parseInt(dateLine[2]); Date date = new Date(); date.setYear(year); date.setMonth(month - 1); date.setDate(day); SimpleDateFormat dateFormat = new SimpleDateFormat("MMM dd, yyyy", Locale.ENGLISH); System.out.println(dateFormat.format(date).toUpperCase()); //напишите тут ваш код } }