何やら流行っているようなので書いてみた。
http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html
import Control.Monad
import Data.List
import Data.Maybe
iFizzBuzz :: [String] -> Maybe (Int, Int)
iFizzBuzz inp = listToMaybe . map snd . sort $ do
start <- [1..15]
let (pos, fbs) = unzip . take (length inp) $ do
x <- [start..]
let fizz = x `mod` 3 == 0
buzz = x `mod` 5 == 0
guard $ fizz || buzz
return (x, (if fizz then "fizz" else "") ++ (if buzz then "buzz" else ""))
guard $ inp == fbs
return (last pos - head pos, (head pos, last pos))
main = print . iFizzBuzz . words =<< getContents