题解 | #后缀子串排序#

后缀子串排序

https://www.nowcoder.com/practice/f89f96ea3145418b8e6c3eb75773f65a

#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    string a;
    while (cin >> a ) { 
        int len=a.size();
        string b[len];
        int lenth=len;
        for(int i=0;i<len;i++)
        {
            b[i]=a.substr(i,lenth);
            lenth--;
        }        
        sort(b,b+len);
        for(int i=0;i<len;i++)
        {
            cout<<b[i]<<endl;
        }  
    }
}

全部评论

相关推荐

练习生懒羊羊:开飞机把这个公司创飞吧
点赞 评论 收藏
分享
求offer的大角牛:不吃香菜
点赞 评论 收藏
分享
frutiger:逆天,我家就安阳的,这hr咋能说3k的,你送外卖不比这工资高得多?还说大厂来的6k,打发叫花子的呢?这hr是怎么做到说昧良心的话的
找工作时遇到的神仙HR
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务