fork(2) download
  1. #include <cstdio>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int czy_palindrom(const char* t)
  6. {
  7. int i=0;
  8. int dlugosc = strlen(t);
  9. int tmp = dlugosc-1;
  10.  
  11. for (i=0;i<=tmp;i++,tmp--){
  12. if (t[i]!=t[tmp]){
  13. return 0;
  14. }
  15. }
  16. return 1;
  17. }
  18.  
  19. int main() {
  20. printf("%d",czy_palindrom("ala"));
  21. printf("%d",czy_palindrom("kajak"));
  22. printf("%d",czy_palindrom("kobylamamalybok"));
  23. printf("%d",czy_palindrom("palindrom"));
  24. return 0;
  25. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
1110