Print all suffixes?

 

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

void print_all_suffixes(char str[]){
for (int e = strlen(str); e >= 0; --e) {
for (int s = strlen(str); s >= e ; --s) {
cout << str[s];
}
cout << '\n' ;
}
}

int main (){
char str[] = "abcd";
print_all_suffixes(str);

return 0 ;
}

Comments

Popular posts from this blog

CodeChef::CSUB

How Recursion Works?

CodeChef::TREE2