tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 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