Write a script to check whether a given string is palindrome or not.

echo -e “Enter the String::\c”

read str

l=echo $str|wc -c

echo expr $l - 1

while [ $l -gt 0 ]

do

temp=echo $str|cut -c $l

l=expr $l - 1

rev=$rev””$temp

done

if [ $str = $rev ]

then

echo String is palindrome

else

echo String is  not palindrome

fi

 

OUTPUT::

 

Enter the String::madam

String is palindrome

 

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.