#include <iostream> #include<cstring> #include<algorithm> using namespace std; bool cmp(string a,string b){ return a < b; } int main() { string word; cin >> word; int len = word.length(), i; string* str = new string[len]; for(i = 0;i < len; i++){ str[i] = word.substr(i, len - i); } sort(str, str + len, cmp); for(i = 0;i < len; i++){ cout << str[i] << endl; } return 0; }