题解 | #后缀子串排序#
后缀子串排序
https://www.nowcoder.com/practice/f89f96ea3145418b8e6c3eb75773f65a
#include <iostream> #include <cstring> #include <algorithm> const int N = 100010; using namespace std; int main() { string s; string sub[N]; cin >> s; int l = s.size(); //提取字符串 for(int i = 0;i < l; i++) { sub[i] = s.substr(i, l - i); } sort(sub, sub + l); for(int i = 0;i < l; i++ ) { cout << sub[i] << endl; } return 0; }