second implementation of palindrom