Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <stdio.h>
- #define DELIM " ,.?!;:"
- void isPalindrome(char str[])
- {
- // Start from leftmost and rightmost corners of str
- int l = 0;
- int h = strlen(str) - 1;
- // Keep comparing characters while they are same
- while (h > l)
- {
- if (str[l++] != str[h--])
- {
- printf("%s is Not Palindrome", str);
- return;
- }
- }
- printf("%s is palindrome", str);
- }
- int main()
- {
- char str[] = "maam kucuk";
- char *p, *start, *end, res = NULL;
- int len, flag, min, flag_min = 0;
- char piece = strtok(str, DELIM);
- while (piece != NULL){
- isPalindrome(piece);
- printf("\n");
- piece = strtok(NULL, DELIM);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement