fork download
  1. s = ["A", "C", "G", "T"]
  2.  
  3. lists = s.product(s,s,s)
  4. t = []
  5. lists.each{|i|
  6. k = i.join()
  7. if k.include?("AAG")
  8. t.push(k)
  9. end
  10. }
  11.  
  12. p t
  13. puts "Count=" + t.length.to_s
Success #stdin #stdout 0.01s 7484KB
stdin
Standard input is empty
stdout
["AAAG", "AAGA", "AAGC", "AAGG", "AAGT", "CAAG", "GAAG", "TAAG"]
Count=8