Advertisement
godsqueezy

Untitled

Jun 11th, 2020
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <string.h>
  2. #include <stdio.h>
  3. #define DELIM " ,.?!;:"
  4.  
  5. void isPalindrome(char str[])
  6. {
  7. // Start from leftmost and rightmost corners of str
  8. int l = 0;
  9. int h = strlen(str) - 1;
  10.  
  11. // Keep comparing characters while they are same
  12. while (h > l)
  13. {
  14. if (str[l++] != str[h--])
  15. {
  16. printf("%s is Not Palindrome", str);
  17. return;
  18. }
  19. }
  20. printf("%s is palindrome", str);
  21. }
  22.  
  23. int main()
  24. {
  25. char str[] = "maam kucuk";
  26. char *p, *start, *end, res = NULL;
  27. int len, flag, min, flag_min = 0;
  28. char piece = strtok(str, DELIM);
  29.  
  30. while (piece != NULL){
  31. isPalindrome(piece);
  32. printf("\n");
  33. piece = strtok(NULL, DELIM);
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement