字母长度排列

#include <bits/stdc++.h>
using namespace std;
bool len(string &a,string &b){
    return a.length()<b.length();
}
int main(int argc, char** argv) {
    vector<string> words{"a","bgtthrtga","mon","money"};
    sort(words.begin(),words.end(),len);
    cout<<"排列";
    for(string l: words){
        cout<<l<<" ";
    }
    return 0;
}

 

posted @ 2025-07-26 15:23  黛玉醉打将门神  阅读(5)  评论(0)    收藏  举报