I made a program which is checking if a word is a palindrome.
But if I type "Lol" it says that's palindrome.
I think palindrome must be completly same. ?
public static bool IsPalindrome(string text)
{
int min = 0;
int max = text.Length - 1;
while (true)
{
if (min > max)
{
return true;
}
char a = text[min];
char b = text[max];
if (char.ToLower(a) != char.ToLower(b))
{
return false;
}
min++;
max--;
}
}
Input: "Lol" Output: "Lol is NOT a palindrome"