using System;
using System.Text;
public class Program
{
public static void Main()
//Console.WriteLine("Hello World");
}
public bool IsPalindrome(string s) {
// define the start of the string
int i = 0;
// define the end of the string
int j = s.Length - 1;
// Format the string to all lower case
s = s.ToLower();
// iterate through the string while the the beginning of the string is still smaller than the end of the string (two pointer?)
while (i < j) {
// if the character is NOT a letter or digit when examingint he character at the beginning of s (i), then increase i by 1 (moves pointer forwards and ignores white space or special chars)
if (!char.IsLetterOrDigit(s[i])) {
i++;
// else if the char is NOT a letter or digit when examining the char at the end of s (j), then subtract j by 1 (moves pointer backwards and ignores white space or special chars)
if (!char.IsLetterOrDigit(s[j])) {
j--;
// else if the position of current iterated value within s + 1 does not equal the position of j -1, then return false (means the string may have not had many, if not at all, non special characters or white space)
if (s[i++] != s[j--]) {
return false;
return true;
// now that the above procedure has removed all anti criteria from the input, we can return true