#include <stdio.h>
#include <ctype.h>
#include <string.h>

int palindromo(char *str)
{
	int i,n;
	
	n=strlen(str);
	if (n==0) return 0;
    for (i=0;i<(n/2);i++)
	 {
      if (str[i]!=str[n-i-1])
        return 0;
     }
     return 1;
}



int main(void)
{

	char str[21], tmp[21], ch;
	int res;

	printf("Inserisci una stringa.\n");
	scanf("%20[A-Za-z0-9',! ]", str);
	printf("Ho letto %s\n", str);
	int i=0, j=0;
	while ((i<20)&&(str[i]!='\0'))
	{
	  if ((isalpha(str[i]))||(isdigit(str[i])))
	  {
	  tmp[j]=toupper(str[i]);
	  j++;
	  }
	  i++;
	}
	tmp[j]='\0';
	res=palindromo(tmp);
	if (res==1)
	  printf("'%s' e' palindroma\n",tmp);
	else
	  printf("'%s' non e' palindroma\n",tmp);
          scanf("%s", &ch);
	return(0);
}

