You can read the input in parts:
import java.util.Scanner; public class Main { public static void main(final String[] args) { System.out.println("Π£ΠΊΠ°ΠΆΠΈΡΠ΅ Π΄Π°ΡΡ ΡΠΎΠΆΠ΄Π΅Π½ΠΈΡ: "); final Scanner scanner = new Scanner(System.in); final int date = scanner.nextInt(); final String month = scanner.next(); System.out.println("ΠΡ ΡΠΊΠ°Π·Π°Π»ΠΈ '" + date + "' '" + month + "'"); } }
Or take it entirely and cut it:
import java.util.Scanner; public class Main { public static void main(final String[] args) { System.out.println("Π£ΠΊΠ°ΠΆΠΈΡΠ΅ Π΄Π°ΡΡ ΡΠΎΠΆΠ΄Π΅Π½ΠΈΡ: "); final Scanner scanner = new Scanner(System.in); final String[] tokens = scanner.nextLine().split(" "); final int date = Integer.decode(tokens[0]); final String month = tokens[1]; System.out.println("ΠΡ ΡΠΊΠ°Π·Π°Π»ΠΈ '" + date + "' '" + month + "'"); } }
Or you can play with regular expressions:
import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(final String[] args) { System.out.println("Π£ΠΊΠ°ΠΆΠΈΡΠ΅ Π΄Π°ΡΡ ΡΠΎΠΆΠ΄Π΅Π½ΠΈΡ: "); final Scanner scanner = new Scanner(System.in); final String line = scanner.nextLine(); final Matcher matcher = Pattern.compile("(\\d+)\\s(.+)").matcher(line); if (matcher.find()) { final int date = Integer.decode(matcher.group(1)); final String month = matcher.group(2); System.out.println("ΠΡ ΡΠΊΠ°Π·Π°Π»ΠΈ '" + date + "' '" + month + "'"); } else { System.out.println("ΠΠ΅ΠΏΡΠ°Π²ΠΈΠ»ΡΠ½ΡΠΉ Π²Π²ΠΎΠ΄."); } } }
PS For good, also exceptions would be nice to catch.