fork download
  1. //(c)Terminator
  2. #include <stdio.h>
  3. #include <ctype.h>
  4.  
  5.  
  6.  
  7. const char* fpolyw(const char* s, const char** f, const char** l){
  8. const char* p, *t;
  9.  
  10. while(*s) {
  11. while(*s && ! isalpha(*s))
  12. ++s;
  13.  
  14. for(p = s; isalpha(*p); ++p);
  15.  
  16. t = p;
  17. if((p - s) > 2){
  18. *f = s;
  19. *l = p;
  20. for(--p; p > s; ++s, --p){
  21. if(*p != *s)
  22. break;
  23. }
  24. if(*p == *s)
  25. return t;
  26. }
  27. s = t;
  28. }
  29. return NULL;
  30. }
  31.  
  32.  
  33.  
  34. int main(void){
  35. const char* p, *f, *l;
  36.  
  37. char s[] = "ABCEEExEEECBA???the, bla ADA, WOW, adida, spam,kook";
  38.  
  39. p = &s[0];
  40. while((p = fpolyw(p, &f, &l)) != NULL){
  41. // fwrite(f, sizeof(char), (size_t)(l - f), stdout);
  42. while(f != l)
  43. putchar(*f++);
  44. putchar('\n');
  45. }
  46. return 0;
  47. }
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
ABCEEExEEECBA
ADA
WOW
adida
kook