W.A.S.S to check whether a given string is palindrome or not.
Program
# W.A.S.S to check whether a given string is palindrome or not.
#07MCG20
echo "Enter any string"
read str
len=`echo $str | wc -c`
len=`expr $len - 1`
result=""
while test $len -gt 0
do
temp=`echo $str | cut -c $len`
len=`expr $len - 1`
result=`echo $result$temp`
done
echo "$result"
if test "$result" = "$str"
then
echo "Given string is palimdrom"
else
echo "Given string is not palimdrom"
fi
Output
Enter any string
madam
madam
Given string is palimdrome
Enter any string
mca
acm
Given string is not palimdrome