fork(2) download
  1. main = interact $ show . f
  2.  
  3. z f=tail>>=zipWith f
  4. g c=and.z c.filter(/=0).map abs.z(-).map fromEnum
  5. (a:b:r)%c|a==b=(b:r)%c|1<3=c a b
  6. f s|a<-[g(>=)s,g(<=)s]=or a:a++[s%(<),s%(>)]
  7.  
  8. -- output: [SW?, CF?, CP?, CW?, CC?]
Success #stdin #stdout 0s 4724KB
stdin
opera
stdout
[True,True,False,True,False]