后缀子串排序 题解:
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
while(cin >> s){
int n = s.length();
vector<string> str(n);
for(int i=0;i<n;i++)
str[i] = s.substr(i);// 从第i位开始到最后
sort(str.begin(),str.end());
for(auto it:str)
cout << it << endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发