Răspuns:
#include<iostream>
#include<string>
using namespace std;
void printSufix(string s, string builder = "")
{
if(s.size() == 0) {
cout<<builder;
return;
}
cout<<builder<<endl;
builder = s[s.size() - 1] + builder;
s.erase(s.size() -1 ,1);
printSufix(s,builder);
}
int main()
{
string s;
cin>>s;
printSufix(s);
}
Da ti-am facut si o varianta mai simpla si mai boring oricum :D
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char s[51];
cin.get(s,51);
int n = strlen(s); //Este mai eficient sa apelezi
//asta odata decat de 100 de ori in foruri
for(int i = 0; i <= n; i++){
for(int j=n-i;j<n;j++)
cout<<s[j];
cout<<endl;
}
}