|
|
вернуться в форумWhat's wrong with my algo? #include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std; bool lesslength(const string& s1, const string& s2) { return s1.length()<s2.length(); } int main() { string s; vector<string>a; while((cin>>s))
{
a.push_back(s);
} stable_sort(a.begin(),a.end(),lesslength); vector<string>::iterator pos; for ( pos = a.begin(); pos != a.end(); ++pos) { cout<<*pos<<endl; } return 0; } I've WA 2. Re: What's wrong with my algo? It's not just about length |
|
|