#include <stdio.h>
#include <string.h>
int isPalindrome(const char *str, int start, int end) {
while (start < end) {
if (str[start] != str[end]) {
return 0; // Not a palindrome
}
start++;
end--;
}
return 1; // Palindrome
}
int main() {
char str[100] = "hi nen hih";
int len = strlen(str);
int wordStart = 0; // Start index of the current word
for (int i = 0; i <= len; i++) {
if (str[i] == ' ' || str[i] == '\0') {
int wordEnd = i - 1; // End index of the current word
int wordLen = wordEnd - wordStart + 1;
if (isPalindrome(str, wordStart, wordEnd) && wordLen > 1) {
for (int j = wordStart; j <= wordEnd; j++) {
printf("%c", str[j]);
}
printf("\n");
}
wordStart = i + 1; // Move to the start of the next word
}
}
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: