Info2/25.4.3.c
2025-04-23 18:30:22 +02:00

42 lines
676 B
C

#include <stdio.h>
#include <string.h>
#include <ctype.h>
int is_palindrome(char *wort)
{
int len = strlen(wort);
int i;
for (i = 0; i < len / 2; i++)
{
if (tolower(wort[i]) != tolower(wort[len - 1 - i]))
{
return 0;
}
}
return 1;
}
int main()
{
char text[1001];
char *teiler = " ,:";
char *token;
printf("Geben Sie Zeilen ein:\n");
scanf("%1000[^\n]s",text);
token = strtok(text, teiler);
while (token != NULL)
{
if (is_palindrome(token) == 1)
{
printf("........ %s\n", token);
}
token = strtok(NULL, teiler);
}
return 0;
}