fork(1) download
  1. def run_program(input)
  2. # "$*[0]" replaced with "input" (not possible to simulate command-line args in IDEONE)
  3.  
  4. x=(1..81).select{|j|input.split(?,).all?{|y|i=j-1
  5. z='SML'
  6. [z[i%9/3]+?H,z[i%3]+?E,z[i/27]+?B,z[i/9%3]+?F].member?(y[-2,2])^y[?!]}}
  7. p x==[]?[0]:x
  8.  
  9. end
  10.  
  11.  
  12. run_program('SH,LB,ME,SF')
  13. run_program('!SH,LB,!ME,SF')
  14. run_program('SB,!MF,!LF')
  15. run_program('MH,!MH')
  16.  
Success #stdin #stdout 0.02s 7416KB
stdin
Standard input is empty
stdout
[56]
[58, 60, 61, 63]
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[0]