>>978
Ruby で作った

require "csv"

input_str = <<"EOT"
RED,BLUE,APPLE
RED,BLUE,BANANA
RED,BLUE,GREEN,ORANGE
RED,BLUE,YELLOW,WHITE,GRAPE
RED,BLUE,WHITE,CHERRY
DOG,CAT,RABBIT,COW,BEAR
EOT

csv = CSV.new( input_str )
input_ary = csv.read # 2次元配列

# 各単語の出現回数を数える。Hash の初期値は、0
hash = input_ary.each_with_object( Hash.new( 0 ) ) { |row, hash|
row.each { |word| hash[ word ] += 1 }
}

# 出現回数が2以上の単語を削除する
input_ary.map! { |row|
row.delete_if { |word| hash[ word ] >= 2 }
row
}

# 2次元配列を、CSV 文字列に変換する
csv_str = input_ary.map( &:to_csv ).join
puts csv_str