using System;
class Program
{
static void Main()
string input;
do
Console.Write("escriu una paraula o frase: ");
input = Console.ReadLine().ToUpper();
if (input == "TENET")
break;
string processed = RemoveSpacesAndPunctuation(input);
string reversed = ReverseString(processed);
if (processed == reversed)
Console.WriteLine("palíndrom");
else
Console.WriteLine("no palíndrom.");
} while (true);
}
static string ReverseString(string text)
char[] array = text.ToCharArray();
Array.Reverse(array);
return new string(array);
static string RemoveSpacesAndPunctuation(string text)
char[] validChars = text.ToCharArray();
string result = "";
foreach (char c in validChars)
if (char.IsLetterOrDigit(c))
result += c;
return result;