-- A palindromic number reads the same both ways. The largest palindrome made
-- from the product of two 2-digit numbers is 9009 = 91 × 99.
-- Find the largest palindrome made from the product of two 3-digit numbers.


import Data.List
import Data.Maybe

maxpal :: Integer -> Maybe Integer
maxpal n = find (\x -> ispal $ show x) $ fmap (*n) $ reverse [n..999]
  where ispal s = s == reverse s

main :: IO ()
main = do
  putStrLn . show . fromJust . maximum $ fmap maxpal $ reverse [100..999]
