fork download
  1. echo "Enter a string to be entered:"
  2. read str
  3. len=`echo $str | wc -c`
  4. len=`expr $len - 1`
  5. i=1
  6. j=`expr $len / 2`
  7. while test $i -le $j
  8. do
  9. k=`echo $str | cut -c $i`
  10. l=`echo $str | cut -c $len`
  11. if test $k != $l
  12. then
  13. echo "String is not palindrome"
  14. exit
  15. fi
  16. i=`expr $i + 1`
  17. len=`expr $len - 1`
  18. done
  19. echo "String is palindrome"
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty