Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Palindrome-detection/Fantom/palindrome-detection.fantom
Normal file
20
Task/Palindrome-detection/Fantom/palindrome-detection.fantom
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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(" ","")))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue