Update p-p18(longestPalinodrom).js

cleaned up the code