#include <stdio.h>

int isValidCharacter(char character)
{
	return ('a' <= character && character <= 'z') 
		  || ('A' <= character && character <= 'Z') 
			|| ('0' <= character && character <= '9');
}


int isPalindrome(int stringlen, char* string)
{
  int m = 0;
  int n = stringlen - 1;

	while (m <= n) {
		if      (!isValidCharacter(string[m])) m++;
		else if (!isValidCharacter(string[n])) n--;
    else if (string[m] != string[n]) return 0;
		else { m++; n--; }
	}

	return 1;
}

int main(int argc, char* argv[])
{
  printf("Palindrome 1 (1): %d\n", isPalindrome(4, "abba"));
}
