C++ | Custom-sort | STL
\nclass Solution {\npublic:\n\t//compare function\n    static bool compare(string s1,string s2){\n\t\t//get the substrings after the first white space character
```\nclass Solution {\npublic:\n\t//compare function\n    static bool compare(string s1,string s2){\n\t\t//get the substrings after the first white space character\n        string aa = s1.substr(s1.find(\' \'));\n        string bb = s2.substr(s2.find(\' \'));\n        \n\t\t//if the substrings are equal, decide the order based on , else decide with respect to substrings\n        return aa == bb ? s1 < s2 : aa < bb;\n    }\n\t\n\t//main function\n    vector<string> reorderLogFiles(vector<string>& logs) {\n        \n\t\t//result vector\n        vector<string> result;\n        int count = 0;\n        \n\t\t//iterate over the logs vector once\n        for(auto log : logs){\n\t\t\t//if it\'s worded -> insert in front of the result\n            if(log.back() <= \'z\' and log.back() >= \'a\') result.insert(result.begin(),log),count++;\n\t\t\t//else insert back\n            else result.push_back(log);\n        }\n        \n\t\t//sort the first "count" number of elements\n        sort(result.begin(),result.begin()+count,compare);\n\t\t//return the result\n        return result;\n    }\n};\n```
['C', 'C++']