后缀子串排序
后缀子串排序
http://www.nowcoder.com/questionTerminal/f89f96ea3145418b8e6c3eb75773f65a
使用 set 就好了
#include<iostream>
#include<set>
using namespace std;
int main(){
string s;
while(cin >> s){
set<string> m;
int n = s.size();
for(int i = 0; i < n; i ++)
m.insert(s.substr(i));
for(auto it = m.begin(); it != m.end(); it ++)
cout << *it << endl;
}
return 0;
} 算法题解 文章被收录于专栏
不定期更新一些算法题解,有什么问题可以随时留言~
查看18道真题和解析