Jave solution
```\nclass Solution {\n    public String[] reorderLogFiles(String[] logs) {\n       Comparator myComp = new Comparator() {\n         @Override\n         public 
```\nclass Solution {\n    public String[] reorderLogFiles(String[] logs) {\n       Comparator<String> myComp = new Comparator<String>() {\n         @Override\n         public int compare(String s1, String s2) {\n           String[] split1 = s1.split(" ", 2);\n           String[] split2 = s2.split(" ", 2);\n           boolean isDigit1 = Character.isDigit(split1[1].charAt(0));\n           boolean isDigit2 = Character.isDigit(split2[1].charAt(0));\n           if(!isDigit1 && !isDigit2) {             \n             int comp = split1[1].compareTo(split2[1]);\n             if(comp != 0)\n              return comp;\n              return split1[0].compareTo(split2[0]);\n           }\n             return isDigit1 ? (isDigit2 ? 0 : 1) : -1;\n         }\n       };\n       Arrays.sort(logs, myComp);\n       return logs;\n    }\n}
[]