Easy understand java solution
using some build-in method in Character and override compare  method\n\npublic String[] reorderLogFiles(String[] logs) {\n        Arrays.sort(logs, new Comparat
using some build-in method in Character and override compare  method\n```\npublic String[] reorderLogFiles(String[] logs) {\n        Arrays.sort(logs, new Comparator<String>() {\n            @Override\n            public int compare(String s1, String s2) {\n                String[] strs1 = s1.split(" ");\n                String[] strs2 = s2.split(" ");\n                if (Character.isDigit(strs1[1].charAt(0)) && Character.isDigit(strs2[1].charAt(0))) return 0;\n                if (Character.isLetter(strs1[1].charAt(0)) && Character.isDigit(strs2[1].charAt(0))) return -1;\n                if (Character.isDigit(strs1[1].charAt(0)) && Character.isLetter(strs2[1].charAt(0))) return 1;\n\n                String log1 = s1.substring(s1.indexOf(" ") + 1);\n                String log2 = s2.substring(s2.indexOf(" ") + 1);\n                if (log1.equals(log2)) {\n                    return strs1[0].compareTo(strs2[0]);\n                }\n                return log1.compareTo(log2);\n            }\n        });\n        return logs;\n    }\n```
[]