clear
echo " STRING PALINDROME OF NOT"
echo " ========================"
echo "ENTER STRING : "
read str
len=`echo $str | wc -c`
i=1
while [ $i -le $len ]
do
ch=`echo $str | cut -c $i`
revstr="$ch$revstr"
i=`expr $i + 1`
done
if [ "$str" == "$revstr" ];then
echo "String is palindrome"
else
echo "String is not palindrome"
fi
echo " STRING PALINDROME OF NOT"
echo " ========================"
echo "ENTER STRING : "
read str
len=`echo $str | wc -c`
i=1
while [ $i -le $len ]
do
ch=`echo $str | cut -c $i`
revstr="$ch$revstr"
i=`expr $i + 1`
done
if [ "$str" == "$revstr" ];then
echo "String is palindrome"
else
echo "String is not palindrome"
fi
No comments:
Post a Comment