Easy Java Solution
class Solution {\n    public String[] reorderLogFiles(String[] logs) {\n        Arrays.sort(logs, new CompareString());\n        return logs;\n    }\n    \n    
class Solution {\n    public String[] reorderLogFiles(String[] logs) {\n        Arrays.sort(logs, new CompareString());\n        return logs;\n    }\n    \n    class CompareString implements Comparator<String>{\n        public int compare(String A, String B){\n            int index1=A.indexOf(" ")+1;\n            int index2=B.indexOf(" ")+1;\n            \n            String str1=A.substring(index1);\n            String str2=B.substring(index2);\n            \n            if(!Character.isDigit(str1.charAt(0)) && !Character.isDigit(str2.charAt(0))){\n                if(!str1.equals(str2)){\n                    return str1.compareTo(str2);\n                }\n                else{\n                    return A.compareTo(B);\n                }\n            }\n            else if(Character.isDigit(str1.charAt(0)) && Character.isDigit(str2.charAt(0))){\n                return 0;\n              }\n            else if(Character.isDigit(str1.charAt(0)) && !Character.isDigit(str2.charAt(0))){\n                return 1;\n            }\n            else if(!Character.isDigit(str1.charAt(0)) && Character.isDigit(str2.charAt(0))){\n                return -1;\n            }\n            return 0;\n        }\n    }\n}\n```\n\n```
[]