后缀子串排序(C++) 题解:
#include<bits/stdc++.h>
using namespace std;
string str;
int main()
{
while(cin >> str)
{
vector<string> a;
int n = str.size();
for(int i = 0; i < n; i ++)
a.push_back(str.substr(i, n - i));
sort(a.begin(), a.end());
for(auto s : a)
cout << s << endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发