first implementation of palindroms