using System;
using System.Linq;
using System.Text.RegularExpressions;
class PalindromeChecker
{
public static bool IsPalindrome(string s) {
// Remove non-alphanumeric characters and convert to lowercase
string normalized = Regex.Replace(s, "[^a-zA-Z0-9]", "").ToLower();
Console.WriteLine(normalized);
// Reverse the string and compare
string reversed = new string(normalized.Reverse().ToArray());
return normalized == reversed;
}
static void Main()
{
string s = "+^-Ab#c!D 50...# 05*()dcB[]A##@!$";
Console.WriteLine(IsPalindrome(s));
}
}
/*
run:
abcd5005dcba
True
*/