题解 | #后缀子串排序#
后缀子串排序
https://www.nowcoder.com/practice/f89f96ea3145418b8e6c3eb75773f65a
#include <iostream>
#include<cstring>
#include<algorithm>
using namespace std;
bool cmp(string a,string b){
return a < b;
}
int main() {
string word;
cin >> word;
int len = word.length(), i;
string* str = new string[len];
for(i = 0;i < len; i++){
str[i] = word.substr(i, len - i);
}
sort(str, str + len, cmp);
for(i = 0;i < len; i++){
cout << str[i] << endl;
}
return 0;
}
SHEIN希音公司福利 370人发布
