C++|Easy to Understand |Custom Sort
\nclass Solution {\npublic:\n    static bool compare(string &a,string &b){\n        //find the content from both the strings.\n        string substr1 = string(a
```\nclass Solution {\npublic:\n    static bool compare(string &a,string &b){\n        //find the content from both the strings.\n        string substr1 = string(a.begin() + a.find(\' \'), a.end());\n        string substr2 = string(b.begin() + b.find(\' \'), b.end());\n\t\t//if both are equal, sort with identifiers,else with content.\n        return (substr1 == substr2) ? a < b : substr1 < substr2;\n    }\n    vector<string> reorderLogFiles(vector<string>& logs) {\n        int count = 0;\n        int index = logs.size()-1;\n\t\t//First calculate the number of letter logs and partition the vector.\n\t\t//The reason for why we are starting from reverse is because we don\'t care about relative ordering of letter logs,\n\t\t//however we want digit logs in relative order and also they must be at the rear.\n        for(int i = logs.size() - 1 ; i >= 0 ; i--)\n        {\n            int pos = logs[i].find(\' \');\n\t\t\t//if it is digit then swap and decrease the index.\n            if(isdigit(logs[i][pos+1]))\n                swap(logs[index--],logs[i]);\n\t\t\t//increase count.\n            else\n                count++;\n        }\n\t\t//we sort only the letter logs which are at the front.\n        sort(logs.begin(),logs.begin()+count,compare);\n        return logs;\n        \n    }\n};\n```
['C', 'C++']