LISP program to check whether a given string is a palindrome
kw.lisp
(write-line"———————————————————————————————————————————")(write-line"Program to check whether string is palindrome")(write-line"———————————————————————————————————————————")(princ"Enter the string ")(setqs(string(read)))(setqs1(strings))(setqs2(reverses1))(if(string-equals1s2)(formatt"~%~d is palindrome"s1))(if(string-not-equals1s2)(formatt"~%~d is not palindrome"s1))(terpri)(princ"———————————————————————————————————————————")
Output
kodingwindow@kw:~$ clisp kw.lisp
———————————————————————————————————————————
Program to check whether string is palindrome
———————————————————————————————————————————
Enter the string LOYAL
LOYAL is not palindrome
———————————————————————————————————————————
kodingwindow@kw:~$ clisp kw.lisp
———————————————————————————————————————————
Program to check whether string is palindrome
———————————————————————————————————————————
Enter the string LOL
LOL is palindrome
———————————————————————————————————————————
kodingwindow@kw:~$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.