//土尔逊Torson 编写于2023/4/22 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <string> #include <stdlib.h> using namespace std; const int MAXK = 1000; struct text { char head; string body; }; text a[MAXK]; bool comp0491(text left, text right) { if (left.body <= right.body) { return true; } else { return false; } } int main() { string s; while (getline(cin, s)) { for (int i = 0; i < s.size(); i++) { a[i].body = s.substr(i, s.size() - i); } sort(a,a+s.size(),comp0491); for (int i = 0; i < s.size(); i++) { printf("%s\n", a[i].body.c_str()); } } system("pause"); return EXIT_SUCCESS; } // 64 位输出请用 printf("%lld")