5 import qualified Data.Set as DS
9 getinput :: [Char] *File -> [[Char]]
11 # (ok, c, f) = freadc f
12 | not ok = if (a =: []) [] [reverse a]
13 | c == '\n' = [reverse a:getinput [] f]
16 parse :: [Char] -> (Int, [(Int, Int)])
17 parse c = case split " " (toString c) of
19 # [offsetx:offsety:_] = split "," offset
20 # offsety = offsety % (0, textSize offsety-2)
21 # [sizex:sizey:_] = split "x" size
23 \\x<-[toInt offsetx+1..toInt offsetx+toInt sizex]
24 , y<-[toInt offsety+1..toInt offsety+toInt sizey]
30 = proc $ map parse $ getinput [] io
34 p (i, cs) rest=:[x:xs]
35 | 'DS'.null $ 'DS'.intersection ('DS'.fromList cs) $ 'DS'.fromList $ flatten $ map snd rest = i
36 | not (trace_t ".") = undef
37 = p x $ xs ++ [(i,cs)]