题解 | #后缀子串排序#
后缀子串排序
https://www.nowcoder.com/practice/f89f96ea3145418b8e6c3eb75773f65a
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { string str; cin>>str; vector<string> a; int i=str.size()-1,n=str.size(); while(i>=0){ a.push_back(str.substr(i,n)); i--; } sort(a.begin(),a.end()); for(int i=0;i<a.size();i++) cout<<a[i]<<endl; return 0; }