Как итог - задание не приняли.....
package com.javarush.task.jdk13.task09.task0930;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
/*
Задача по алгоритмам
*/
public class Solution {
public static ArraySorter arraySorter = new ArraySorter();
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
List<String> allList = new ArrayList<>();
String s = scanner.nextLine();
while (!s.isEmpty()) {
allList.add(s);
s = scanner.nextLine();
}
for(String str: allList){
System.out.println(str);
}
List<String> stry = new ArrayList<>();
List<Integer> inty = new ArrayList<>();
for (String str: allList){
if(isNumber(str)){
inty.add(Integer.parseInt(str));
}else{
stry.add(str);
}
}
Collections.sort(stry);
Collections.sort(inty);
Collections.reverse(inty);
System.out.println("Вводим строчки по алфавиту ");
for(String str: stry){
System.out.println(str);
}
System.out.println("Выводим числа по убыванию ");
for(Integer in: inty){
System.out.println(in);
}
}
public static boolean isNumber(String s){
char[] result = s.toCharArray();
int count = 0;
for (int i = 0; i < result.length; i++) {
char ch = result[i];
if(ch == '1' || ch == '2' || ch == '3' || ch == '4' || ch == '5' || ch == '6' || ch == '7' || ch == '8' || ch == '9' || ch == '0'){
count++;
}else{
break;
}
}
boolean as = (count == result.length);
return as;
}
}