C++ solution with custom stable sort
\nclass Solution {\npublic:\n    vector<string> reorderLogFiles(vector<string>& logs) {\n              \n        stable_sort(logs.begin(), logs.end(), [](string
```\nclass Solution {\npublic:\n    vector<string> reorderLogFiles(vector<string>& logs) {\n              \n        stable_sort(logs.begin(), logs.end(), [](string s1, string s2)\n             {                 \n                 if(isdigit(s1.back()))\n                     return false;\n                 \n                 //s1 is a letter-log and s2 is a digit-lot\n                 if(isdigit(s2.back()))\n                     return true;\n                \n                 //both are letter-log\n                 string ss1 = s1.substr(s1.find(\' \'));\n                 string ss2 = s2.substr(s2.find(\' \'));\n\n                 if(ss1 == ss2)\n                    return s1 < s2;\n\n                 return ss1 < ss2;\n\n             });\n        \n        return logs;\n        \n    }\n};\n```
[]