fork download
  1. main = mapM
  2. (print . winCount)
  3. ["gpgpgppppg","ggggggggggggggg","ccpcpppcccpppcppcpcc","ggcgcgcggggcpgcggcgcggggcgcgcc"]
  4.  
  5. count e = length . filter (e ==)
  6. winCount s
  7. | count 0 [g, c, p] /= 1 = 0
  8. | p == 0 = g
  9. | g == 0 = c
  10. | c == 0 = p
  11. where [g, c, p] = zipWith count "gcp" [s, s, s]
  12.  
Success #stdin #stdout 0s 4544KB
stdin
Standard input is empty
stdout
6
0
10
0