Cpp | Stable Sort
\nbool Comp(const string& a, const string& b) {\n    int space_1 = a.find(\' \');\n    int space_2 = b.find(\' \');\n    string identifier1 = a.substr(0,space_1
```\nbool Comp(const string& a, const string& b) {\n    int space_1 = a.find(\' \');\n    int space_2 = b.find(\' \');\n    string identifier1 = a.substr(0,space_1);\n    string identifier2 = b.substr(0,space_2);\n    string log1 = a.substr(space_1+1);\n    string log2 = b.substr(space_2+1);\n    bool isDigitLog1 = isdigit(log1.at(0));\n    bool isDigitLog2 = isdigit(log2.at(0));\n    if(isDigitLog1 && !isDigitLog2)\n        return false;\n    if(!isDigitLog1 && isDigitLog2)\n        return true;\n    if(isDigitLog1 && isDigitLog2)\n        return false;\n    if(log1 == log2)\n        return identifier1 < identifier2;\n    return log1 < log2;\n}\n\nclass Solution {\npublic:\n    vector<string> reorderLogFiles(vector<string>& logs) {\n        stable_sort(logs.begin(), logs.end(), Comp); // Ensures if elements are same, order is maintained\n        return logs;\n    }\n};\n```
['C++']