20 lines
485 B
Text
20 lines
485 B
Text
class Palindrome
|
|
{
|
|
// Function to test if given string is a palindrome
|
|
public static Bool isPalindrome (Str str)
|
|
{
|
|
str == str.reverse
|
|
}
|
|
|
|
// Give it a test run
|
|
public static Void main ()
|
|
{
|
|
echo (isPalindrome(""))
|
|
echo (isPalindrome("a"))
|
|
echo (isPalindrome("aa"))
|
|
echo (isPalindrome("aba"))
|
|
echo (isPalindrome("abb"))
|
|
echo (isPalindrome("salàlas"))
|
|
echo (isPalindrome("In girum imus nocte et consumimur igni".lower.replace(" ","")))
|
|
}
|
|
}
|