one more solution

p (0..(2**5-1)).map{|n| (n.to_s 2).tr("01", "CN").rjust(5,"C") }

-- 
Posted via http://www.ruby-forum.com/.