changed while loop in longest pal