clear
echo "Enter string \c"
read str
len=`echo $str|wc -c`
len=`expr $len - 1`
echo "length is "$len
i=1
while [ $i -le $len ]
do
revstr=`echo $str|cut -c$i`$revstr
i=`expr $i + 1`
done
if [ "$revstr" == "$str" ];then
echo "string is palindrome"
else
echo "string is not palindrome"
fi
0 comments:
Post a Comment