Implementation of pal using string<->integer conversion